I am working on a custom action in Alfresco. I want the action to be available as both multi select and as well as action for each items. If I add new action I could see the icon. But in multi select the action icon is not displaying. How to display image to the multi select actions?
Here is my code:
The OOTB multi-select actions for the Document Library can be found in the share-documentlibrary-config.xml file.
<multi-select>
<action type="action-link" id="onActionDownload" icon="document-download" label="menu.selected-items.download" />
<action type="action-link" id="onActionCopyTo" icon="document-copy-to" label="menu.selected-items.copy" />
<action type="action-link" id="onActionMoveTo" icon="document-move-to" permission="Delete" label="menu.selected-items.move"/>
<action type="action-link" id="onActionAssignWorkflow" asset="document" icon="document-assign-workflow" label="menu.selected-items.assign-workflow"/>
<action type="action-link" id="onActionDelete" icon="document-delete" permission="Delete" label="menu.selected-items.delete" notAspect="hwf:hybridWorkflow,sys:undeletable" />
<action type="action-link" id="onActionCloudSync" asset="document" icon="document-cloud-sync" permission="CreateChildren" label="menu.selected-items.cloudSync" notAspect="sync:syncSetMemberNode" syncMode="ON_PREMISE" />
<action type="action-link" id="onActionCloudSyncRequest" icon="document-request-sync" label="menu.selected-items.cloudRequestSync" hasAspect="sync:syncSetMemberNode" syncMode="ON_PREMISE" />
</multi-select>
If you want additional multi-select actions to be displayed then you will want to augment this configuration attribute. Rather than editing this file directly you'll want to provide an extension to this particular configuration section (you can find some documentation of this here)
It would be worth reviewing how the existing multi-select actions are implemented to ensure that your custom action is compatible as both a single item action and a multi-select action
Looks like this is done by overwriting some of the ootb javascript, specifically the toolbar.lib.js and the toolbar.get.config.xml.
It's obfuscated in the title, but I believe this post answers your question:
How to extend toolbar.get.config.xml in Alfresco Share
Related
when browse my site from local iis then address looks in browser address bar as http://localhost:8800/gb/default.aspx
i tried to extract country code from browser address bar and injected in all hyperlink's href with IIS rewrite outbound rule.
this is my outbound rule i used in my web.config file.
<outboundRules>
<rule name="add outbound rule" preCondition="Ishtml" enabled="true" stopProcessing="true">
<match filterByTags="A" pattern="(\/[a-z]+\/)(.*)" negate="true" />
<action type="Rewrite" value="{R:1}{R:2}" />
</rule>
<preConditions>
<preCondition name="Ishtml">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="text/html" />
</preCondition>
</preConditions>
</outboundRules>
when i pattern test from iis rewrite module window then output looks like below one. here is screen shot.
so during test i saw {R:1} is /gb/ and {R:2} is default.aspx. so when this rule execute it change all hyperlink href in default.aspx page and all hyperlink href becomes now http://localhost:8800/gb/default.aspx
basically i need to inject country code from browser address bar url in all hyperlink href of current page.
i think i am bit closer to what i am trying to achieve but now i need little help to sort this issue. i guess this area need to be change bit <action type="Rewrite" value="{R:1}{R:2}" />
so please some help and drive me to right direction.
Your rewrite action will not work as you back reference to parts of the match of the rule with {R:1} and {R:2} but this will never match as you negated it with negate="true". I.e. if it doesn't match that regular expression the {R:1} and {R:2} will (most likely) also not be available.
What you have to do is add an extra condition that matches on the query string with the same regular expression. This condition will make sure that the current URL will match that regular expression and then you can back reference parts of that with {C:1} and {C:2}, etc... (with the letter C instead of R). The trick is to use a combination of {C:1} and {R:0}. {C:1} will give you the language code from the current URL and {R:0} will give you the original URL from the <a href>.
So you will end up with:
<outboundRules>
<rule name="add outbound rule" preCondition="Ishtml" enabled="true" stopProcessing="true">
<match filterByTags="A" pattern="^\/(?![a-z]{2}\/).*" />
<action type="Rewrite" value="{C:1}{R:0}" />
<conditions>
<add input="{HTTP_X_ORIGINAL_URL}" pattern="^(\/[a-z]{2})\/(.*)" />
</conditions>
</rule>
<preConditions>
<preCondition name="Ishtml">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="text/html" />
</preCondition>
</preConditions>
</outboundRules>
On a side note, your regular expression for the A tag is very weak. It will match /gb/default.aspx but it will also match /foo/bar/default.aspx or /foo/bar/gb/default.aspx and thus not rewrite these links. I've replaced it with a more strict version only matching /<two letters>/<anything>.
Note that I took the \/ after the match for the first two letters out of the first group in the condition as we don't need that slash in the back reference {C:1} as it's already in {R:0}.
EDIT: I made the assumption that {R:0} would still be available as a back reference even if the regular expression would not match. This does not seem to be the case. So I took out the negate="true" and fixed the regular expression to match any URL except those starting with /<two-letters/ (to prevent rewriting already correct URL's).
Another error was to match on {REQUEST_URI} assuming this was the original URL as seen in the browser with the language code in it. But most obviously it's not as you probably (inbound) rewrite that URL and take out the language code. So I replaced that with {HTTP_X_ORIGINAL_URL}. This is a variable set by the URL Rewrite module and preserves the original URL.
Lastly the <add ..> in the <condition>...</condition> was missing a closing /. I hope this now works for you.
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>
I need to customize Plone login form without make changes in plone original login-form https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/skins/plone_login/login_form.cpt so there are two ways first i use override.zcml to change login-form :
<browser:page
for="OFS.interfaces.IApplication"
name="plone-root-login"
class="Products.CMFPlone.browser.admin.RootLoginRedirect"
permission="cmf.ManagePortal"
template="templates/login.pt"
/>
and another a simple login.pt file.It generating an Trace:
File "/Plone/buildout-cache/eggs/Products.CMFPlone-4.3.3-py2.7.egg/Products/CMFPlone/browser/admin.zcml", line 43.2-48.8
<browser:page
for="OFS.interfaces.IApplication"
name="plone-root-login"
class=".admin.RootLoginRedirect"
permission="cmf.ManagePortal"
/>
File "/Plone/buildout-cache/eggs/my_app.egg/my/app/browser/overrides.zcml", line 7.4-12.10
<browser:page
for="OFS.interfaces.IApplication"
name="plone-root-login"
class=".admin.RootLoginRedirect"
permission="cmf.ManagePortal"
/>
And Second Method: external_login_url in default/propertiesTool.xml i tried but changes not reflected
I have an ASP.NET page with URL Rewrite and when I post a message to the page, it reveals the ID. So for example, I have a page
http://www.example.com/info/earth
When I post a comment to the page, the address bar becomes
http://www.example.com/info/earth?info=earth
How do I prevent the ?info=earth from appearing in the address bar after a post submission has occurred.
My form without LT & GT is :-
form runat="server" method="post" id="fForm"
The form is on an ASP.NET control and not on the main form because I use the control on other pages rather than just the one page. My IIS Rewrite rule is :-
(rule name="Rewrite for info" stopProcessing="true")
(match url="info/(.+)" /)
(conditions logicalGrouping="MatchAll")
(add input="{URL}" negate="true" pattern="\.axd$" /)
(/conditions)
(action type="Rewrite" url="info.aspx?info={R:1}" /)
(/rule)
Your help is appreciated.
Just set appendQueryString to false
<action type="Rewrite" url="info.aspx?info={R:1}" appendQueryString="false" />
Does anyone know if I can inject value from pages.xml into a Seam component? In pages.xml there seems to be an in element that would indicate I can but I can't figure out how to use it & documentation is lacking.
I'm trying to set a value in a component that varies from page to page. It needs to be set for page load & I don't want it exposed to the user. Here's what I've tried at the moment:
<page view-id="/daily.xhtml">
<in name="chartLoader.reportType" value="DAILY"/>
<action execute="#{chartLoader.loadData}" />
</page>
<page view-id="/hourly.xhtml">
<in name="#{chartLoader.reportType}" value="HOURLY"/>
<action execute="#{chartLoader.loadData}" />
</page>
Neither of these work now with an error of:
javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation
The reportType property is private but it has the correct public setter method. So I'm thinking that my syntax is slightly off.
Does anyone know how to use this element correctly or have a better suggestion?
Thanks,
Lee
Try this instead
<action execute="#{chartLoader.setReportType('DAILY')}"/>