I wonder if it's possible to add a "recycle bin" button in the Alfresco share header.
(source: alfresco.com)
As of 4.2 the trashcan is available to any user. It is a link in their profile. For example, to go to the trash can directly via URL, the link is:
https://localhost:8080/share/page/user/[USER_NAME]/user-trashcan
So it should be a trivial customization to add a link to this in the Share header.
But you need to know that the trashcan at the moment is admin only. There is JIRA, but it hasn't been fixed yet.
So without some heavy customization you can bring the button to the menu, but you'll need to be an admin.
There is a cool addon which shows the button on your personal profile:
https://forums.alfresco.com/forum/developer-discussions/add-ons/personal-user-trash-can-07192013-1200
https://github.com/atolcd/alfresco-my-deleted-items
I've been trying with the deployment of these modules, but I've not been successful. The installation of these modules have attempted using the MMT and AMP modes.
As Jeff already mentioned it strongly depends on the version you are running. From 4.2.x on you can add a line to the following file:
tomcat/webapps/share/WEB-INF/classes/alfresco/share-config.xml
add the following line:
<item type="link" id="trash" label="Trash">/user/{userid}/user-trashcan</item>
and set legacy mode to true:
<legacy-mode-enabled>true</legacy-mode-enabled>
then it will look like:
<!-- This indicates whether or not to use the configuration defined in this "header" element for rendering
the header menu bar. If this is set to "false" or it not defined then the header bar will be rendered
using the design implemented for 4.2 Enterprise. The header definition can be found in the associated
WebScript controller.
-->
<legacy-mode-enabled>true</legacy-mode-enabled>
<!-- This is the configuration that will be used to populate the header menu bar when "legacy-mode-enabled"
has been set to true -->
<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="link" id="trash" label="Trash">/user/{userid}/user-trashcan</item>
<item type="container" id="more">
<container-group id="my">
<item type="link" id="my-tasks">/my-tasks#filter=workflows|active</item>
<item type="link" id="my-workflows">/my-workflows#filter=workflows|active</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>
the original trashcan entry within the container group will not work any more as it links to the old before V4.2 admin trash can. You can remove that line if you like.
Related
My PyQT5 application is working fine on Linux, macOS and some Windows PCs, but on some Windows 10 PCs the top row of buttons is obscured by the window frame / title bar:
Not only are the buttons obscured, you have to click below the buttons in order to click on them, so the click locations appear to be correct but the buttons are shown above the click locations.
The buttons are created in a QT Creator UI file as follows:
<widget class="QMainWindow" name="MainWindow">
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="10">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="OpenButton">
Versions: PyQt 5.6.0, qt5.6.2 from Miniconda
As indicated by #Arpegius, this turns out to be due to the Intel Graphics Driver (see QT bug 62127.
The problem disappears if I configure the QT application to use my NVidia adapter instead of my Intel adapter.
I've made a component and I'd like to show that component on the document-details page only if the document has a certain aspect, so I tried to use an evaluator. I've added this bean in custom-slingshot-application-context.xml
<bean id="evaluator.doclib.metadata.hasInvoiceAspect"
parent="evaluator.doclib.action.propertyNotNull">
<property name="property" value="inv:invoice"/>
</bean>
In document-details.xml I added this
<component>
<region-id>custom-comp</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation>
<evaluators>
<evaluator type="evaluator.doclib.metadata.hasInvoiceAspect"/>
</evaluators>
<url>/components/custom/custom-comp</url>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
I guess I've missed something as the component doesn't show up. I have 2 files named custom-slingshot, I tried both tomcat/shared/classes/alfresco/web-extension and tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension.
Am I completely wrong with this? Is it possible to achieve what I want like that? How should I proceed?
There is a predefined evaluator to check whether a node has an aspect called evaluator.doclib.action.hasAspect. You simply need to create a bean with this evaluator as the parent and give an aspect to check against in the properties:
*added to some -context.xml in web-extension
<bean id="my.custom.evaluator" parent="evaluator.doclib.action.hasAspect">
<property name="aspects">
<list>
<value>my:hasInvoiceAspect</value>
</list>
</property>
</bean>
Then you'll reference that bean in your DocLibActions config added to *extension-modules.xml (web-extension/site-data/extensions)...
<config condition="DocLibActions" evaluator="string-compare">
<actions>
<action...>
<!-- Custom evaluator -->
<evaluator>my.custom.evaluator</evaluator>
</action>
</actions>
</config>
Voila.
More info on predefined evaluators.
Good sample project here.
In Alfresco, how to disable actions in multiselect drop down. Assume I have delete couple of files. So i am selecting all those files. Now, if any of the selected files have a specific aspect then the delete option should not be enabled. How can I achieve this?
This is what I tried. But no luck.
<action type="action-link" id="onActionDelete" label="menu.selected-items.delete" notAspect="p:hasSecondaryParent" />
My expectation here is if any of the selected items have "p:hasSecondaryParent" aspect then I do not want the "Delete" action in "Selected Items" drop down. All other time it should display
You need to create action evaluator for that. There is out of box has aspect evaluator available which you need to utilize set your custom aspect in that evaluator. Now add that evaluator in config of delete action. Restart server And that's it.
Ex.
<bean id="evaluator.doclib.indicator.exifMetadata" class="org.alfresco.web.evaluator.HasAspectEvaluator">
<property name="aspects">
<list>
<value>exif:exif</value>
</list>
</property>
This is example from out of box context file you need to replace aspect name and id of evaluator. Then Add this evaluator in your action config.
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<!-- Download document -->
<action id="custom-action" type="link" label="customaction">
<evaluator>evaluator.doclib.indicator.exifMetadata</evaluator>
</action>
</actions>
<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
<property name="prefix" value="" />
<property name="suffix" value=".vm"></property>
<property name="contentType" value="text/html;charset=UTF-8" />
<property name="layoutUrl" value="layout/default.vm" />
</bean>
how the key word "layoutUrl" work in VelocityLayoutViewResolver?
Its very common to have a dynamic web page divided into a layout part and a content part. The layout part might consist of a header, a footer, a sidebar, a navigation and so on. Elements meant to look more or less the same on every response, that is. But the content part differs, because that's where the action goes on, right?
Layout and content should be kept apart in different .vm files, so that the layout has to be designed (and changed) only once and the content part doesn't have to repeat anything.
The question is how to put those two parts together on each response. One approach is to parse the layout file in every content file. But as the layout usually wraps the content this very likely leads to more than one parsed layout file per content file.
A better way is to reverse that and to merge the content into the layout. This is way easier to handle. All you have to do is to declare a .vm file to work as the general layout file. In this file you put a var named $screen_content and magically the view you returned in your controller at a certain request is blended in at that spot.
Your layoutUrl property tells path and file name of your layout file relative to the resourceLoaderPath you have declared in this bean
<bean
id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<beans:property name="resourceLoaderPath" value="/WEB-INF/templates/" />
</bean>
Following your example...
<bean
id="viewResolver"
class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
...
<property name="layoutUrl" value="layout/default.vm" />
</bean>
...your layout file has to be /WEB-INF/templates/layout/default.vm
Typically, a dialog wishes to have tab navigation proceed in an orderly fashion through a dialog that roughly corresponds to the order of reading a book.
When new fields are added to a dialog by engineers on a team, the new widgets can often not be inserted in tab correct order.
Can anyone think of a way to automate the detection of out of tab navigation order widgets within a dialog?
I assume you're speaking about QtDesigner *.ui files.
Out of order tabbing occurs when the order of GridLayout/FormLayout items in a ui file (actually xml file) differs from the visual order (left-to-right, top-to-bottom). Like this:
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget .../>
</item>
<item row="1" column="0">
<widget .../>
</item>
...
</layout>
Note that the third row comes before the first, which means in the generated code (and also when loading ui dynamically) the widget from the third row will be added first and will come first in the tab order.
Here's the XLST you can use on a ui file to "fix" the tab order, it removes all manually set tab stops and arranges xml items in visual order.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="#*|node()">
<!-- Copy everything -->
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="layout">
<xsl:copy>
<xsl:apply-templates select="#*|node()">
<!-- Sort layout items in the visual order -->
<xsl:sort select="#row" data-type="number"/>
<xsl:sort select="#column" data-type="number"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="tabstops">
<!-- Remove (i.e. do not copy) manual tab stops -->
</xsl:template>
</xsl:stylesheet>
Detecting but not fixing the problem is a bit harder, because manually set tab stops must be taken into account. Basic algorithm is as follows:
Build the "raw" tab order by walking xml depth-first and collecting widget names and associated item's row and column (when present) and layout name in a list.
Augment the raw order with manual tab stops, i.e. rearrange the list according to <tabstops> section in the xml, one pair at a time (like QWidget.setTabOrder does it).
Scan the list and check then all rows and columns are in order (independently for each layout name).
It sounds like you have a .ui file with a QTabWidget and a multitude of pages all in on .ui file. I would suggest splitting things up a little bit more. Implement each Tab as a widget by itself, this can be in the desginer too. Then you have two options for the TabWidget itself. Create all the tabs in the designer and promote the content to the widget class that needs to go on that page. Or leave the TabWidget completely empty and populate it in code with the appropriate subwidgets.