I would like to customize the share UI header, for example remove some of buttons such as People and Shared files. I found that this can be done by modifying the share-header.lib.js file located in the tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/share/imports folder.
On modifying this file, I can see the changes. But as has been advised in these links:
https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/correctbest-way-customize-shares-ui-07182011
http://ecmarchitect.com/archives/2010/09/07/1212
The right way would be to create the same folder structure under the tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension directory and put the modified file there. I created the folder hierarchy and copied the share-header.lib.js file in this folder with the changes but now the changes are not seen on the website. Am I missing something ? Can anyone advise on the right method to do this ?
Thanks !
The general guideline that tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension overrides tomcat/webapps/share/WEB-INF/classes/alfresco is correct but there is one big caveat: it only works for webscripts.
In your case there are two files involved in the generation of the header:
WEB-INF/classes/alfresco/site-webscripts/org/alfresco/share/header/share-header.get.js
WEB-INF/classes/alfresco/site-webscripts/org/alfresco/share/imports/share-header.lib.js
The former belongs indeed to a webscript (you'll find a share-header.get.desc.xml in the same directory). This file can be overridden by placing a file in a similar directory structure under WEB-INF/classes/alfresco/web-extension as you've correctly found in your research.
The latter however is not part of a webscript. Rather it is imported through an import directive. Importing is a completely different mechanism and the WEB-INF/classes/alfresco/web-extension trick doesn't work here.
The first lines of share-header.get.js clarify this:
<import resource="classpath:/alfresco/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
model.jsonModel = {
rootNodeId: "share-header",
...
The imported resource is loaded from the classpath literally, without any web-extension overlay. To import your customised version of share-header.lib.js, the first line should have been:
<import resource="classpath:/alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
So in summary my recommendation is to customise both header/share-header.get.js (just the first line) and imports/share-header.lib.js (as you've already done).
Remember that when you create a new customisation file it is safer to restart Alfresco. On the other hand when you edit an existing customisation file it is sufficient to visit /share/service/index on your local installation and click on Refresh Web Scripts and Clean Dependency Caches.
Actually, your approach isn't the best one.
As in Alfresco documentation you should configure your share-config-custom.xml in tomcat/shared/classes/web-extension folder. You should find a sample file there.
Look for the original one share-config.xml in share webapp folder: and search for the <header> tag. It will look something similar to this:
<app-items>
<!-- defaults: icon="{id}.png" label="header.{id}.label" description="header.{id}.description" -->
<item type="link" id="my-dashboard">{userdashboardpage}</item>
<item type="js" id="sites">Alfresco.module.Sites</item>
<item type="link" id="people">/people-finder</item>
<item type="link" id="repository" condition="conditionRepositoryRootNode">/repository</item>
<item type="container" id="more">
<container-group id="my">
<item type="link" id="my-tasks">/my-tasks</item>
<item type="link" id="my-workflows">/my-workflows</item>
<item type="link" id="my-content">/user/user-content</item>
<item type="link" id="my-sites">/user/user-sites</item>
<item type="link" id="my-profile">{userprofilepage}</item>
</container-group>
<container-group id="tools" permission="admin">
<item type="link" id="application">/console/admin-console/application</item>
<item type="link" id="groups">/console/admin-console/groups</item>
<item type="link" id="replication-jobs" condition="!conditionEditionTeam">/console/admin-console/replication-jobs</item>
<item type="link" id="repository">/console/admin-console/repository</item>
<item type="link" id="trashcan">/console/admin-console/trashcan</item>
<item type="link" id="users">/console/admin-console/users</item>
<item type="link" id="more">/console/admin-console/</item>
</container-group>
</item>
</app-items>
Copy the entire section in your share-config-custom.xml file. make your changes and restart Alfresco. You should be good to go.
Related
I want to add custom CSS file for the Arabic Language.
I found how to add a CSS file to the local.xml like this
<action method="addItem"><type>skin_css</type><name>css/custom_style.css</name></action>
But I want to specify it for one language only.
Any idea how to implement this behavior?
In layout file you can use this code outside of default tag
<layout version="0.1.0">
<STORE_arabic>
<reference name="head">
<action method="addCss">
<stylesheet>css/custom_css.css</stylesheet>
<params>media="screen"</params>
</action>
</reference>
</STORE_arabic>
<default>
...
</default>
</layout>
'arabic' is your store code.
If you can work out a means of how, just add your stylesheet in regardless of language / locality and add a class to the body tag.
<body class="arabic">
and add that selector to your new stylesheet.
I am creating a Eclipse e4 RCP Application. I want to add a image at the background. I have tried adding property in plugin.xml:
<property
name="applicationCSSResources"
value="platform:/plugin/rcptutorial/image/image.jpg">
Also, I created a new folder "Images" and added "image.jpg in it. I also added the line in default.css:
Shell { background-image: url('./image.jpg');}
But nothing happens when I run it. I can apply background-color but unable to add image.
Please help.
My Plugin.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
name="org.rcptutorial.rcp"
application="org.eclipse.e4.ui.workbench.swt.E4Application">
<property
name="lifeCycleURI"
value="bundleclass://rcptutorial/org.rcptutorial.rcp.E4LifeCycle">
</property>
<property
name="applicationCSS"
value="platform:/plugin/rcptutorial/css/default.css">
</property>
<property
name="applicationCSSResources"
value="platform:/plugin/rcptutorial/images/">
</property>
</product>
</extension>
</plugin>
My default.css is as follows:
Shell { background-image: url('./images/image.jpg');}
I have an "images" folder that contains the image "image.jpg". The folder is located inside my project
applicationCSSResources must specify a folder which contains the images:
<property
name="applicationCSSResources"
value="platform:/plugin/rcptutorial/image/">
</property>
(the ending '/' must be present).
The URL in the CSS should just be:
url('./image.jpg')
I'm stepping through "Eclipse 4 Plug-in Development by Example Beginner's Guide", and on section "Time for action – styling the UI with CSS".
The instructions here specify to edit "css/default.css" and add the following:
Shell {
background-color: blue;
}
Unfortunately, this has no effect. The background is still the default greyish color.
What can I do to debug this?
I tried running the "CSS Spy" tool, but I don't understand how to use it.
Update:
Here is my entire plugin.xml file:
<plugin>
<extension id="product"
point="org.eclipse.core.runtime.products">
<product name="com.packtpub.e4.application"
application="org.eclipse.e4.ui.workbench.swt.E4Application">
<property name="appName" value="com.packtpub.e4.application">
</property>
</product>
</extension>
</plugin>
The instructions in the section don't mention anything to do in here. Where is there more information about what should be in here for this "simple" application?
Update:
So it appears that the book instructions neglected to mention the need for the "applicationCSS" property setting. I added that manually as directed, and that fixed the problem.
The advice about "You should also specify the CSS name in the .product file" brings up additional questions.
It wasn't clear to me why this should also be done, in addition to setting the property in the plugin.xml file. The field on that wizard page doesn't really explain what the value is used for, but it sounded to me like it has the same purpose as setting that property.
So, I tried removing the manual setting in the "plugin.xml" file and using the wizard to browse for the file. I saved that and then inspected the "plugin.xml" file, as I expected that action in the wizard to populate that property. There was no change. I then looked at the wizard again and read the statement after that field, which said this (weird that selecting that text in the wizard and pressing Ctrl-C doesn't put the text into the clipboard):
'You must Synchronize (this word a hyperlink) the product's defining plug-in to ensure that the CSS file specified above is referenced in the plug-in's "org.eclipse.core.runtime.products" extension point.'
So I tried clicking that hyperlink. That inserted the property into the plugin.xml file. This brings up more questions.
If it's apparently important that "the CSS file specified above" is specified as the "applicationCSS" property in the "plugin.xml" file, why does the developer need to take a deliberate action to make this happen, as opposed to Eclipse just mirroring that value in the property?
The reference to the "org.eclipse.core.runtime.products" extension point is curious. When I view the "plugin.xml" file for a non-e4 Eclipse application, I see tabs for "Extensions" and "Extension Points", but not when I view the wizard for this sample e4 application. In addition, I don't see any reference to extensions or extension points in this generated "plugin.xml" file.
Is the value entered into the wizard used for ANYTHING except to use it to (manually) synchronize the value of the "applicationCSS" property?
You must have an applicationCSS entry in the product entry in the plugin.xml (or a cssTheme if using themes) without this no CSS styling will be done.
Something like:
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
name="greg.e4App2"
application="org.eclipse.e4.ui.workbench.swt.E4Application">
<property
name="applicationCSS"
value="platform:/plugin/greg.e4App2/css/default.css">
</property>
<property
name="appName"
value="greg.e4App2">
</property>
</product>
</extension>
You should also specify the CSS name in the .product file on the 'Customization' tab in the 'CSS Styling' section.
Also check that the 'css' folder is included in the 'build.properties'
I'm moving from a legacy system over to Wordpress. I've read that the WXR import format isn't officially documented, but that this sample can be used as documentation.
With that said, why isn't this post tagged with "awesome"? The awesome tag is created in the top of the WXR file with
<tag>
<term_idname>2781</term_idname>
<tag_slug>awesome</tag_slug>
<tag_name>
<![CDATA[awesome]]>
</tag_name>
</tag>
And I find it in the backend after importing. The post is however not tagged. No posts are tagged. But all tags are imported, just with 0 children. This is how I try to import the post:
<item>
<title>The title is awesome</title>
<link>http://example.com/awesome</link>
<creator>This Ramvi</creator>
<guid isPermaLink="false">http://example.com/awesome</guid>
<description></description>
<encoded>
<![CDATA[<p>Very short post
</p>]]>
</encoded>
<post_id>843156</post_id>
<post_date>2014-10-22 10:34</post_date>
<post_date_gmt>2014-10-22 08:34</post_date_gmt>
<comment_status>open</comment_status>
<ping_status>open</ping_status>
<post_name>Really awesome post</post_name>
<status>publish</status>
<category domain="tag">
<![CDATA[awesome]]>
</category>
<post_type>post</post_type>
</item>
Can you spot what I'm doing wrong?
The answer is pretty much in the sample linked to in the question. You need two lines to add tags to a post:
<category domain="tag"><![CDATA[NewTag]]></category>
<category domain="tag" nicename="newtag"><![CDATA[NewTag]]></category>
Trying to add a folder rule which should specialize cm:content to our custom type my:content (which inherits from cm:content).
We have configured the following in share-config-custom.xml:
<type name="cm:content">
<subtype name="my:content"/>
</type>
Our type shows up correctly in the specialize type action in the document library, but when trying to specify a rule the listbox that should contain our type remains empty. :(
What could we be missing?
You need to add to web-client-config-custom.xml in alfresco/extension
<config evaluator="string-compare" condition="Action Wizards"
replace="true">
<subtypes>
<type name="my:content" />
</subtypes>
<specialise-types>
<type name="my:content" />
</specialise-types>
</config>
And then the trick is to provide title & description for the types in the content model or via messages/properties; otherwise they will not be there.
Wrote about similar issues here: http://experiencewithalfresco.blogspot.dk/2012/08/remember-to-define-title-and.html
For adding custom messages you need to create custom-message-context.xml
<beans>
<bean id="mycompany.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.custom</value>
</list>
</property>
Then create custom.properties file and place it in /shared/classes/alfresco/message folder.
And for adding custom type to rule your config should be working only thing to make sure is config inside which you have put sub-type related config is proper.
Disclaimer: This answer is for Alfresco 6.2.2+.
Answering an old thread. For me, I tried this thread all vague answers on Alfresco Hub and nothing worked out.
I have been through this nightmare. Its frustrating and I don't know why Alfresco team relies on "Display Label" instead of "Name".
As shown in the screenshot, I was missing Display Label. As soon as I edited my custom type and provided Display Label, all worked as expected.
If I would have designed it, I would include, Name and Display Label both in the drop down in my rule window.
Hope it helps someone like me.