How to add a "display layout"/"view_method" to a folder? - plone

When you visit a folder in plone, its default view is determined by what you've previously selected in the "Display" menu, for example, "Summary view", "standard view", etc. Those options are defined in Products/CMFPlone/profiles/default/types/Folder.xml, with the view_methods tag:
<property name="view_methods">
<element value="folder_summary_view"/>
<element value="folder_full_view"/>
<element value="folder_tabular_view"/>
<element value="atct_album_view"/>
<element value="folder_listing"/>
</property>
And those views are defined at Products/CMFPlone/skins/plone_content.
How can I add my own element to view_method in folders, using another package? How can I override Folder.xml? And where do I put the new template?
Thanks in advance.

you have to create profiles/default/types/Folder.xml containing:
<?xml version="1.0"?>
<object name="Folder">
<property name="view_methods" purge="False">
<element value="my_view"/>
</property>
</object>
and then register it into profiles/default/types.xml:
[...]
<object name="Folder"
meta_type="Factory-based Type Information with dynamic views" />
[...]

Related

How to query All Types of document from Alfresco repository using CMIS

I have Multiple Custom content types, and based on individual type i am able to query documents. But my requirement is i want to get all types of document.
I wrote query select * from hr:hrdoctype, Because my hr:hrdoctype is my parent type for all other types. But its not working.
But if i will write select * from hr:hrReimbursment, This is working fine.
So how can i get all All Custom types of documents with single parent type or with single condition.
Please see the Below configuration.
in this case if i will use specific content type then its working fine. but i want to get all type of document using single query.
Please help me how can i write CMIS Query for this requirement.
Share-config-custom.xml:-
<type name="cm:content">
<subtype name="hr:hrdoctype" />
</type>
<type name="hr:hrdoctype">
<subtype name="hr:hrReimbursment" />
<subtype name="hr:hrMISCELLANEOUS" />
<subtype name="hr:hrWELFARE_POLICIES" />
<subtype name="hr:hrGENERAL_POLICIES" />
<subtype name="hr:hrPOLICIES_SIGNOFF_NOTES_FILE_NOTES" />
<subtype name="hr:hrPHOTOGRAPH" />
<subtype name="hr:hrPIF_PROFILE_OVERVIEW" />
<subtype name="hr:hrMPR_FORM" />
<subtype name="hr:hrPSYOMETRIC_REPORT" />
<subtype name="hr:hrTECHNICAL_TEST_ASSESSEMENT" />
<subtype name="hr:hrINTERVIEW_ASSESSEMENT_SHEET" />
</type>
Custom-content-model.xml:-
<types>
<type name="hr:hrdoctype">
<title>HR Document</title>
<parent>cm:content</parent>
<properties>
<property name="hr:employeeNumber">
<title>Employee Number</title>
<type>d:text</type>
</property>
<property name="hr:employeeName">
<title>Employee Name</title>
<type>d:text</type>
</property>
</properties>
</type>
<type name="hr:hrReimbursment">
<title>REIMBURSEMENT</title>
<parent>hr:hrdoctype</parent>
<properties>
<property name="hr:DocumentDescription">
<title>Document Description</title>
<type>d:text</type>
</property>
<property name="hr:ReimbursmentDate">
<title>Reimbursment Date</title>
<type>d:text</type>
</property>
</properties>
</type>
<type name="hr:hrMISCELLANEOUS">
<title>MISCELLANEOUS</title>
<parent>hr:hrdoctype</parent>
<properties>
<property name="hr:DocumentDescription1">
<title>Document Description</title>
<type>d:text</type>
</property>
</properties>
</type>
</types>
I just tested simillar case on my repository.
There are four base CMIS types: cmis:document, cmis:folder, cmis:relationship, cmis:policy. Types cmis:document and cmis:folder must be supported by any repository.
I my case the myc:xyz type inherits from the cmis:folder type.
CMIS query selecting all folders:
select * from cmis:folder where cmis:name='ABCD'
returns folder:
{
"cmis:objectId": "5b97929c-553b-4494-91cc-2c18e50b2f1c",
"cmis:objectTypeId": "F:myc:xyz",
"cmis:baseTypeId": "cmis:folder",
"cmis:name": "ABCD"
}
CMIS query selecting all myc:xyz folders:
select * from myc:xyz where cmis:name='ABCD'
return the same folder with some myc:xyz type's additional properties:
{
"cmis:objectId": "5b97929c-553b-4494-91cc-2c18e50b2f1c",
"cmis:objectTypeId": "F:myc:xyz",
"cmis:baseTypeId": "cmis:folder",
"cmis:name": "ABCD",
"myc:AdditionalProperty1": "1111",
"myc:AdditionalProperty2": "2222"
}
Hope this helps.
OpenCMIS Client API Developer's Guide
PS. You can test queries with Alfresco CMIS 1.1 "The Browser binding".
For example, this is URL for the query select * from cmis:folder where cmis:name='ABCD' (Firefox automatically decoding encoded parameters in URL, it is very comfortable):
http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/?cmisselector=query&succinct=true&q=select * from cmis:folder where cmis:name='ABCD'

SpringMVC can't request html

SpringMVC can't request html
I define a
#RequestMapping(value = {"/","/index"}).
I can't request index.html:
try adding "/index.html" to the #RequestMapping.
If you are trying to display the 001.html by going to /index, then make sure your 001.html is in the folder your view resolver is looking at
The value of #RequestMapping is not your view name, it's url path.
View name is defined in return.Try return index.html.
If you defined this in spring-servlet.xml:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/" />
<property name="suffix" value=".html" />
</bean>
You need return index.

Alfresco disable full text indexing on specific content model

Using Alfresco 4.2 or 5.0, how do you disable full text indexing on a content-model basis?
Here is an example content model, what do you change specifically (i.e. do not reference the index control aspect without how to actually use it with a content model).
<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
<namespace prefix="my"
uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
<parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
<title>custom key word text field</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
FINAL ANSWER
<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
<namespace prefix="my"
uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
<parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
<title>custom key word text field</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>my:doNotIndexContentControl</aspect>
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
<property name="cm:isIndexed">
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<default>false</default>
</property>
</overrides>
</aspect>
</aspects>
</model>
Important Note: If you get "Source node class has no callback" errors, this is related to changing the content model and then trying to update (likely versionable) existing content. No known workaround, but this is unrelated to index control options.
You can achieve this by defining a new aspect that extends cm:indexControl like so:
<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
<property name="cm:isIndexed">
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<default>false</default>
</property>
</overrides>
</aspect>
Note the overrides. The overridden property, cm:isContentIndexed, with default value set to false is key.
You then add this aspect as mandatory for the types which you do not wish to full text index the content. The full configuration options for cm:indexControl can be found in the documentation http://docs.alfresco.com/4.2/concepts/admin-indexes.html
Also, if you have existing content items that have already been indexed and you want those documents to no longer be indexed, you will need to do a full re-index.
This is covered in the Data Dictionary guide on the Alfresco wiki
All you need to do is all this to your model:
<index enabled="false" />
If you look at something like the Alfresco system model, you'll see several examples of that

In sbt, how can I publish to a resolver defined in an external ivy settings file?

We have numerous ant-based projects which depend on a single ivysettings.xml where our ivy resolvers are defined. I'm creating a new sbt-based project, and according to the DRY principle, I'd like for sbt to also depend on this same ivysettings.xml file (rather than attempting to re-defining the resolvers within the sbt script). This turned out to be really easy, using externalIvySettings() -- at least, for resolving dependencies.
However, we also need to publish to one of the resolvers defined in the file. In ant, this is really easy: <ivy:publish resolver="..." />", however with sbt I'm stumped. Sbt has a publishTo setting which can be used to define a resolver to publish to, but I don't want to define a new resolver. Instead, I want to pull a resolver out of the settings loaded by externalIvySettings(), and pass this to publishTo. Is this possible?
Edit:
Here is the ivysettings.xml file as requested. We want to publish to the "modules" resolver.
<ivysettings>
<properties file="${ivy.settings.dir}/ivysettings.properties" />
<settings defaultResolver="default" defaultResolveMode="dynamic"/>
<property name="x1.resolver" value="x1-fs" override="false"/>
<property name="x2.resolver" value="x2-fs" override="false"/>
<property name="x1.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="x1.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="x2.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="x2.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="local.root" value="${ivy.default.ivy.user.dir}/x1-local" override="true"/>
<property name="local.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="local.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="modules.root" value="${ivy.settings.dir}/ivy/published" override="true"/>
<property name="modules.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="modules.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<!-- some default values for paths to the x2 and x1 repositories; these should be overridden in ivysettings.properties -->
<property name="x2.fs.root" value="${ivy.settings.dir}/ivy/x2root" override="false"/>
<property name="x1.fs.root" value="${ivy.settings.dir}/ivy/x1root" override="false"/>
<property name="ivy.cache.dir" value="${ivy.settings.dir}/ivy/cache"/>
<caches defaultCacheDir="${ivy.cache.dir}"/>
<resolvers>
<filesystem name="x1-fs">
<ivy pattern="${x1.fs.root}/${x1.ivy.pattern}" />
<artifact pattern="${x1.fs.root}/${x1.artifact.pattern}" />
</filesystem>
<filesystem name="x2-fs">
<ivy pattern="${x2.fs.root}/${x2.ivy.pattern}" />
<artifact pattern="${x2.fs.root}/${x2.artifact.pattern}" />
</filesystem>
<chain name="x1">
<resolver ref="${x1.resolver}"/>
</chain>
<chain name="x2">
<resolver ref="${x2.resolver}"/>
</chain>
<filesystem name="local">
<ivy pattern="${local.root}/${local.ivy.pattern}" />
<artifact pattern="${local.root}/${local.artifact.pattern}" />
</filesystem>
<filesystem name="modules" checkmodified="true" changingPattern="*" changingMatcher="glob">
<ivy pattern="${modules.root}/${modules.ivy.pattern}" />
<artifact pattern="${modules.root}/${modules.artifact.pattern}" />
</filesystem>
<chain name="main" dual="true">
<resolver ref="modules"/>
<resolver ref="x1"/>
<resolver ref="x2"/>
</chain>
<chain name="default" returnFirst="true">
<resolver ref="local"/>
<resolver ref="main"/>
</chain>
</resolvers>
</ivysettings>
found the answer in this link https://github.com/sbt/sbt/issues/1999
But the answer is to just reference the resolver by name. In your situation it would be
publishTo := Some(Resolver.file("modules"))
since you want to publish using the "modules" resolver

How to config basing condition in Spring IOC?

How can I config IOC basing condition,like following:
<bean id="beanid" class="com...Class1" >
<if var='xxx'>
<property name="formView"
value="RegistrationApprovalForm" />
<else if var ='yyy'>
<property name="formView"
value="RegistrationApprovalForm1" />
</bean>
so I can put var in properties files,this will make configration easy.
Here is the code.
${ServiceMgmt.showEnabler}
</bean>
I want to redirect to the view based on configuration as below.
else
Is this possible with spring configuration??

Resources