Alfresco share advanced search - alfresco

I have some problem. I am create custom model ed:edocumentswith one aspect ed:zagdep it has one property ed:documentRegnum.
I am customize Advanced Search Form and add RegNum field, but it does not search nothing with this field.
What it can be? Why search does not work?
My model code ed-model.xml (tomcat\shared\classes\alfresco\extension)
<?xml version="1.0" encoding="UTF-8"?>
<model name="ed:edocuments" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.alfresco.com/model/edocuments/1.0" prefix="ed"/>
</namespaces>
<aspects>
<!-- Definition of new Content Aspect: Electronic Document -->
<aspect name="ed:zagdep">
<title>Zag Dep</title>
<properties>
<property name="ed:documentRegnum">
<type>d:text</type>
</property>
</properties>
</aspect>
</aspects>
</model>
My model contex file ed-model-contex.xml (tomcat\shared\classes\alfresco\extension)
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.ed.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/ed-model.xml</value>
</list>
</property>
</bean>
</beans>
My share-config-custom.xml(tomcat\shared\classes\alfresco\web-extension)
<alfresco-config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="cm:generalclassifiable" />
<aspect name="cm:complianceable" />
<aspect name="cm:dublincore" />
<aspect name="cm:effectivity" />
<aspect name="cm:summarizable" />
<aspect name="cm:versionable" />
<aspect name="cm:templatable" />
<aspect name="cm:emailed" />
<aspect name="emailserver:aliasable" />
<aspect name="cm:taggable" />
<aspect name="app:inlineeditable" />
<aspect name="kb:referencable" />
<aspect name="ed:zagdep" />
</visible>
<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>
<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>
</config>
<!-- cm:content type (existing nodes) -->
<config evaluator="node-type" condition="cm:content">
<forms>
<!-- Default form configuration used on the document details and edit metadata pages -->
<form>
<field-visibility>
<show id="ed:documentRegnum" />
</field-visibility>
</form>
<!-- Document Library pop-up Edit Metadata form -->
<form id="doclib-simple-metadata">
<field-visibility>
<show id="ed:documentRegnum" />
</field-visibility>
<edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
</form>
<!-- Document Library Inline Edit form -->
<form id="doclib-inline-edit">
<field-visibility>
<show id="ed:documentRegnum" />
</field-visibility>
</form>
</forms>
</config>
<!-- Advanced search -->
<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
<advanced-search>
<!-- Forms for the advanced search type list -->
<forms>
<form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
<form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>
</forms>
</advanced-search>
</config>
<config evaluator="model-type" condition="cm:content">
<forms>
<!-- Search form -->
<form id="search">
<field-visibility>
<show id="cm:name" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- ed:edocuments -->
<show id="ed:documentRegnum" />
</field-visibility>
<appearance>
<!-- ed:edocuments -->
<field id="ed:documentRegnum" label-id="prop.ed_documentRegnum">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>

You just have to add : force="true" on aspect based property.See below code.
<show id="ed:documentRegnum" force="true" />

Related

Unable to change type of document in alfresco share

I have two questions about two Custom Content Types I created called my:whitepaper and my:bc:
When I try to Change Type on a document and I select my:whitepaper custom type it works but not with my:bc.
When I select my:bc It gives me an error message saying: Unable to change type of document 'test.pdf'.
In "Manage Rules" -> "Specialse Type" , I can't see my bc type:
The type of 'test.pdf' document is cm:content:
Here's my :
custom-model-context.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/customModel.xml</value>
</list>
</property>
<property name="labels">
<list>
<value>alfresco/extension/custom-model-messages</value>
</list>
</property>
</bean>
</beans>
custom-model-messages.properties:
type.my_whitepaper= piece Comptable
type.my_whitepaper.title= piece Comptable
type.my_whitepaper.property.my_product= Ecriture Comptable
type.my_bc=bc
type.my_bc.title=bc
customModel.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<!-- The important part here is the name - Note: the use of the my: namespace
which is defined further on in the document -->
<model name="my:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Example Custom Model</description>
<author>Alfresco Documentation Team</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0"
prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace my.new.model should be changed to reflect
your own namespace -->
<namespaces>
<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="my" />
</namespaces>
<types>
<!-- Enterprise-wide generic document type -->
<type name="my:doc">
<title>MyCompany Generic Document</title>
<parent>cm:content</parent>
</type>
<type name="my:marketingDoc">
<title>MyCompany Marketing Document</title>
<parent>my:doc</parent>
<properties>
<property name="my:product">
<title>écriture comptable</title>
<type>d:text</type>
</property>
<property name="cm:author">
<title>auteur</title>
<type>d:text</type>
</property>
</properties>
</type>
<type name="my:bc">
<title>Bon de commande</title>
<parent>my:marketingDoc</parent>
</type>
<type name="my:whitepaper">
<title>une piece Comptable</title>
<parent>my:marketingDoc</parent>
</type>
</types>
</model>
share-config-custom.xml:
<types>
<type name="cm:content">
<subtype name="smf:smartFolderTemplate" />
<subtype name="my:whitepaper" />
<subtype name="my:bc" />
</type>
<type name="cm:folder">
</type>
<type name="trx:transferTarget">
<subtype name="trx:fileTransferTarget" />
</type>
</types>
<!-- custom content comptable -->
<config evaluator="model-type" condition="my:whitepaper">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" />-->
</field-visibility>
</form>
</forms>
</config>
<config evaluator="node-type" condition="my:whitepaper">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" /> -->
</field-visibility>
</form>
</forms>
</config>
<!-- custom Bon commande -->
<config evaluator="model-type" condition="my:bc">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" />-->
</field-visibility>
</form>
</forms>
</config>
<config evaluator="node-type" condition="my:bc">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" /> -->
</field-visibility>
</form>
</forms>
</config>
Logs:
The logs : alfresco.log and catalina.out don't show anything.
Browser's Developer tools show this:
I am unable to reproduce this problem in a project generated with SDK 3.0.1, taking all defaults (Repo 5.2.f/Share 5.2.e) with your content model and Share config. I can change cm:content objects to my:bc objects. When configuring rules I can select your custom types in the Specialize Type action, see screenshot, below:.
So, either you have some other stuff added to your config that hasn't been included in the above snippets or you haven't deployed your customizations correctly.
You might want to bootstrap a new project and drop your files in as I have, then run it with the embedded Tomcat to make sure you can change types and configure rules successfully. Then you can compare what is in that project to what you have in your original project to see where you went wrong.

display workflow task custom properties on edit task page only (not on workflow details or task details page) alfresco share

I need to hide workflow task custom properties from the workflow-details and task-details page and show only on task-edit page.Currently it is visible on all the three pages.
abcmodel.xml
<type name="abc:review">
<parent>bpm:activitiOutcomeTask</parent>
<mandatory-aspects>
<aspect>abc:Info</aspect>
</mandatory-aspects>
</type>
<aspects>
<aspect name="abc:Info">
<properties>
<property name="abc:Det">
<type>d:mltext</type>
</property>
</properties>
</aspect>
</aspects>
shareconfigcustom.xml
<config evaluator="task-type" condition="abc:review">
<forms>
<form>
<field-visibility>
<show id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
<field id="abc:Det" label="customproperty" read-only="true">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">color: black</control-param>
<control-param name="rows">6</control-param>
<control-param name="columns">6</control-param>
</control>
</field>
<field id="bpm:comment" label="Comments">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
You can use form-id to control them.
To hide the field(abc:det) in the workflow details page, you can use like,
<config evaluator="task-type" condition="abc:review">
<forms>
<form>
<field-visibility>
<show id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
<field id="abc:Det" label="customproperty" read-only="true">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">color: black</control-param>
<control-param name="rows">6</control-param>
<control-param name="columns">6</control-param>
</control>
</field>
<field id="bpm:comment" label="Comments">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
<!-- Form configuration for workflow-details page -->
<form id="workflow-details">
<field-visibility>
<hide id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
.....
</appearance>
</form>
<!-- Form configuration for task-details page -->
<form id="task-details">
<field-visibility>
<hide id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
.....
</appearance>
</form>
</forms>
</config>
I hope you can use, '' to configure the task-details, but I haven't tried it yet.
Update
For the task-details, there is no specific form-id is used in data-form section. Refer C:\<Alfresco_Home>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages\task-details.xml
<!-- Data Form -->
<component>
<region-id>data-form</region-id>
<url>/components/form</url>
<properties>
<itemKind>task</itemKind>
<itemId>{taskId}</itemId>
<mode>view</mode>
<formUI>true</formUI>
</properties>
</component>
To customise this task-details form, I added <formId>task-details</formId> as mentioned below.
<!-- Data Form -->
<component>
<region-id>data-form</region-id>
<url>/components/form</url>
<properties>
<itemKind>task</itemKind>
<itemId>{taskId}</itemId>
<mode>view</mode>
<formUI>true</formUI>
<formId>task-details</formId>
</properties>
</component>
You need to use share extension / customisation best practices to change the OOTB files in share.
Alfresco Share extensions
Finally in the share-config-custom.xml file add the configuration like,
<form id="task-details">
<field-visibility>
<hide id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
.....
</appearance>
</form>
All set to go and it is working fine to me.

to hide custom workflow from another site alfresco share

I need to hide custom workflow list for folders/documents present in " MyFiles " and other sites areas.Doing that from "show-site-workflow-modules.xml " with this configuration(code below), hides workflows from "workflows that I have started" also,which is terribly wrong.
<module>
<id>General_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>.*</sites>
<sitePresets>.*</sitePresets>
<applyForNonSites>true</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all Custom workflows -->
<workflow name="customactiviti$xxxx" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<task type="customwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>
<module>
<id>xxx_Conditional_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>xxx-xxx-xxx</sites>
<applyForNonSites>false</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all WCM related workflows -->
<workflow name="activiti$activitiAdhoc" />
<workflow name="activiti$activitiInvitationModerated" />
<workflow name="activiti$activitiInvitationNominated" />
<workflow name="activiti$activitiInvitationNominatedAddDirect" />
<workflow name="activiti$activitiParallelGroupReview" />
<workflow name="activiti$activitiParallelReview" />
<workflow name="activiti$activitiReview" />
<workflow name="activiti$activitiReviewPooled" />
<workflow name="activiti$publishWebContent" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<!-- Hide all WCM related tasks -->
<task type="wcmwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>

Date Search in AdvancedSearch functionality : Alfresco

I tried advanced search functionality in alfresco. I couldn't search data with date condition..
I can search using other fields..but not with date criteria.
How can I search data with date field.
Following is my custom model
share-config-custom.xml
<config evaluator="model-type" condition="my:test">
<forms>
<form id="search">
<field-visibility>
<show id="my:corDate" />
</field-visibility>
<appearance>
<field id="my:corDate">
<control template="/org/alfresco/components/form/controls/date.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
datatype of my:corDate d:date
following is advanced search code
<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
<advanced-search>
<forms>
<form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
<form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>
<form labelId="type.my_test" descriptionId="search.form.desc.my_test">my:test</form>
</forms>
</advanced-search>
</config>
customModel.xml
<type name="my:test">
<title>Test</title>
<parent>cm:content</parent>
<properties>
<property name="my:corDate">
<title>Correspondence Date</title>
<type>d:date</type>
<mandatory>true</mandatory>
<index enabled="true">
<atomic>true</atomic>
<stored>true</stored>
<tokenised>both</tokenised>
</index>
</property>
</properties>
</type>
How can I solve this problem..How can I do search with date criteria ?
Thanks

Error when saving document of custom type in Alfresco Share

I got this exception when trying to save a new document of custom type:
org.alfresco.service.cmr.repository.MalformedNodeRefException: 06010026 Invalid node ref - does not contain forward slash: {node.nodeRef}
Here is how the definition of the custom type looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="ht:channelmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Imports are required to allow references to definitions in other models
-->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.someco.com/model/content/1.0" prefix="ht" />
</namespaces>
<types>
<!-- Here comes my type -->
<type name="ht:doc">
<title>Custom Document</title>
<parent>cm:content</parent>
<mandatory-aspects>
<aspect>cm:generalclassifiable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="ht:channel">
<title>Content Channel</title>
<properties>
<property name="ht:isWeb">
<type>d:boolean</type>
</property>
</properties>
</aspect>
</aspects>
</model>
and here is how I set the forms for displaying the creation of a new document of my custom type (inside share-config-custom.xml)
<alfresco-config>
<config evaluator="string-compare" condition="DocumentLibrary">
<create-content>
<content id="plain-text" mimetype="text/plain" label="Prompt" itemid="ht:doc" />
</create-content>
<aspects>
<visible>
<aspect name="ht:channel" />
</visible>
<addable>
</addable>
<removeable>
</removeable>
</aspects>
<types>
<type name="cm:content">
<subtype name="ht:doc" />
</type>
</types>
</config>
<config evaluator="model-type" condition="ht:doc">
<forms>
<form>
<field-visibility>
<show id="cm:title" force="true" />
<show id="ht:isWeb" force="true" />
</field-visibility>
<appearance>
<field id="cm:title">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>
Is it something wrong with the formatting or am I missing some fields in the type definition?
Thanks
Found the solution on the dedicated Alfresco forum.
Here it is:
<content id="myContent" label="Prompt" type="pagelink" index="1" >
<param name="page">create-content?destination={nodeRef}&itemId=ht:doc&mimeType=text/html</param>
</content>

Resources