Nuxeo delete button - nuxeo

I'm looking to hide the "Delete" button on the view_documents only if the selected custom document have a boolean property to 1.
I'm using the Studio only ... I tried to implement a contribution to the extension point "filter" but it not seems to work.
Here is the condition I'm using in the contribution:
<extension target="org.nuxeo.ecm.platform.actions.ActionService" point="filters">
<filter id="canDeleteScan">
<rule grant="false">
<condition>#{currentDocument.getProperty("SchemaDocument.scanner").equals("false")}</condition>
</rule>
</filter>
</extension>
Does anyone have an idea ?
Thanks

Related

Automation Steps not firing for custom screen?

I have used automation steps to add an action menu to an existing screen, add approval automation and other automations to an existing screen, and control fields/values of existing screens. Each of those cases appear to work fine. However, I have added a new custom screen that does not require approvals, and automation steps seem to do nothing for me other than adding an action item to the menu.
What would prevent my custom screen from executing my simple automation steps? I have 1 view set as the data member for both the form and tab in a form/tab screen used to break up the data to keep the data simple for the end user to view. The only thing working is that the Action menu option "Convert to Repair" is added to the screen, although it is not disabled as intended nor the status updated when the hold checkbox is changed.
Automation Definition:
<?xml version="1.0" encoding="utf-8"?>
<Screens>
<Screen ScreenID="ZI302000">
<Step StepID="Hold -> Open" Description="Hold -> Open" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="False" Value2="False" Operator="And" />
<Filter FieldName="Status" Condition="Equals" Value="H" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="O" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
<Step StepID="On Hold" Description="On Hold" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="True" Value2="False" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="H" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair" IsDisabled="1">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
</Screen>
</Screens>
As it turns out, it seems the automation steps referenced a node id of an earlier version of the page. After experimenting with some formatting of the page, I removed it and started over. By not removing the old automation steps entirely, the system was firing automation for a page referenced by an outdated node id.
Solution: Delete the automation steps entirely and start over. In my case, I deleted the automation definition as well because I had tried deleting the automation steps before but not the automation definition with no success. I also deleted the site map to the page, the files from the customization project, the files from the OS, and recreated it all from scratch. Once confirmed that automation steps were working on the newly recreated page, I was able to go to a backup copy of the aspx file and paste the contents into my new page aspx file in the customization project to restore all my work on the layout and settings.

How to change search result page from 3 to 1 columns in magento?

I have to change catalog search result page layout 3 from 1 columns layout. I have tried in catalogsearch.xml, but not getting proper result. Can anyone tell me how can I fix it?
Thank you.
Changing the layout in catalogsearch.xml should do the trick, done this way:
Before:
<action method="setTemplate"><template>page/3columns.phtml</template></action>
After:
<action method="setTemplate"><template>page/1column.phtml</template></action>
You should also clear your Magento Cache in admin>System>Cache Management.
Hope this helps.
Or you can in local.xml copy this:
<catalogsearch_result_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</catalogsearch_result_index>

How to prevent self-referencing foreign key values in XSD schema?

My XML (simplified) is like this:
<Actions>
<Action Id="1">
</Action>
<Action Id="2">
<DoSomething>
<ActionRef ActionId="1" /> <!-- valid -->
</DoSomething>
</Action>
</Actions>
The ActionId attribute value references the Id attribute value of the Action element. I've already set up a foreign key constraint in the XSD, and it works correctly.
I want to prevent self-referencing values in the foreign field, like this:
<Actions>
<Action Id="1">
</Action>
<Action Id="2">
<DoSomething>
<ActionRef ActionId="2" /> <!-- invalid -->
</DoSomething>
</Action>
</Actions>
Of course, this can easily be done within the application that processes the XML, and I'll fall back on that if what I'm asking for isn't possible, but I'd much rather have this done automatically by the validation process.
I tried adding [not(#ActionId = ../#Id)] to the foreign key selector XPath query, but that isn't valid in that context (nor am I sure it's correct either). Other than that, I have no idea what else to try, and it doesn't look like many people on the internets even set up foreign key relationships in their XSDs, let alone prevent this kind of situation (I found nothing on this exact topic).
It cannot be done - the selector syntax for XSD constraints is very limited. Other alternatives may include Schematron, which should be reasonable to integrate assuming your runtime has access to an XSLT processor. The effort could pay off is you decide to add more validation rules separate from the code of the application that processes the XML.

DIV identified by WebDevToolbar isnt in file?

I'm trying to use Magento for my shopping cart and want to switch from a right col layout to left col. I've turned on ID/CLASS display on the Web Developer Toolbar in firefox, and am seeing ".main col2-right-layout", which i believe i must switch to ".main col2-left-layout", the alternate style is predefined. but running searches for files with the phrase "col2-right-layout" in them is only pulling up the style sheet. I am searching THE ENTIRE Magento directory. How is this possible? Not case sensitive, and I'm even searching hidden folders. How can it be?
**i have looked in that file, the div is not mentioned. **
Files are in app/layout/default/default/templates/page/
I've not got a dev copy of magento at home, thats all I can remember off the top of my head - will try and remember to confirm when at work.
If you want to swap the templates, you need to look in app/layout/default/default/layout/page.xml, plus some of the other xml files - the templates are defined there.
(Yes, magento's layout/templating system is complicated, and has a steep learning curve, but its worth it!)
col2-right-layout is mentioned in
app/design/frontend/base/default/template/page/2columns-right.phtml
or in Magento 1.3
app/design/frontend/default/default/template/page/2columns-right.phtml
If you want to swap the layout I'd suggest changing it in one of the layout xml files. For the shopping cart edit app/design/frontend/base/default/layout/checkout.xml
change
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
to
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
And similarly for the checkout page in the same file change
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
to
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
As always it is better to make a copy of the file you are editing to your own theme.

Can I make IIS add (inject) HTML to every page it serves?

I would like to add some HTML to every page that our IIS 6 server serves. It's serving static HTML for the most part. Is this something IIS or an extension can do? I would need some control over how and where the HTML is injected, in this case before the tag. Thanks for your suggestions!
Natively I believe the only thing you can do is insert a document footer (on the Documents tab).
If you're familiar with ASP.NET, you could write a HTTP Response Filter to do that.
Read this article by Milan Negovan.
The HttpResponse class has a very useful property:
public Stream Filter {get; set;}
MSDN provides a helpful description of
this property: "Gets or sets a
wrapping filter object used to modify
the HTTP entity body before
transmission." Confused? In other
words, you can assign your own custom
filter to each page response.
HttpResponse will send all content
through your filter. This filter will
be invoked right before the response
goes back to the user and you will
have a change to transform it if need
be.
This could be extremely helpful if you
need to transform output from "legacy"
code or substitute placeholders
(header, footer, navigation, you name
it) with proper code. Besides, at
times it's simply impossible to ensure
that every server control plays by the
rules and produces what you expect it
to. Enter response filters.
The Filter property is of type
System.IO.Stream. To create your own
filter you need to derive a class from
System.IO.Stream (which is an abstract
class) and add implementation to its
numerous methods.
I was able to inject some CSS before the using the URL Rewrite Module, via an outbound rule:
<rewrite>
<rules>
<outboundRules rewriteBeforeCache="true">
<rule name="Add custom CSS" preCondition="IsHTML">
<match filterByTags="None" pattern="</head>" />
<action type="Rewrite" value="<link rel="stylesheet" href="/path/to/custom/styles_override.css"></head>" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rules>
</rewrite>
You should be able to do the same with html content, instead of css...
In IIS proper, you can add a footer, which is great for a copyright line, or similar. If you want more control, to truly "inject", I would create an HTTP Handler (.NET) that handles .html requests and adds what you need.
If you are "old school", use ISAPI filters instead. Too much work for my tastes.

Resources