10-27-2016 08:31 AM
Hello, Alfresco community!
Please, help me.
I've created custom datalist and put it to repository.
Now i'm trying to tune share view to manipulate(create/modify/delete) with it.
So, after creating datalist i'm trying to add new elements to it. I want to choose type of element(for ex: catalogBase or catalogElement), but i can't choose. Share makes item catalogBase by default.
I'm using alfresco repo amp archetype, and alfresco share amp archetype.
This is my customModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="scr:somecoratingsmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0"><!-- Optional meta-data about the model -->
<description>Someco Ratings Model</description><author>Jeff Potts</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" /><!-- Import Alfresco Data List Model Definitions -->
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" /><import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces><namespace uri="http://www.someco.com/model/ratings/1.0" prefix="scr" />
</namespaces>
<types>
<type name="scr:catalogBase">
<title>Catalog Base</title>
<parent>dl:dataListItem</parent>
<associations>
<association name="scr:catalogElements">
<title>childAssociation</title>
<target>
<class>scr:catalogBase</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
<type name="scr:catalogElement">
<title>Catalog Element</title>
<!--<parent>cm:content</parent>-->
<parent>dl:dataListItem</parent><properties>
<property name="scr:title">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="scr:odering">
<type>d:int</type>
<mandatory>true</mandatory>
</property>
<property name="scr:isLeaf">
<type>d:boolean</type>
<mandatory>true</mandatory>
</property>
</properties>
<associations>
<association name="scr:catalogNodes">
<title>childAssociation</title>
<target>
<class>scr:catalogElement</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
</types>
</model>
this is my share-config-custom.xml
<alfresco-config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<types>
<!--<type name="cm:content">-->
<type name="dl:dataListItem"><subtype name="scr:catalogBase" />
<subtype name="scr:catalogElement" />
</type>
<type name="scr:catalogBase">
<subtype name="scr:catalogElement" />
</type>
</types>
</config>
<!-- sc:whitepaper type (existing nodes) -->
<config evaluator="node-type" condition="scr:catalogBase"><forms>
<!-- Default form configuration for the sc:whitepaper type -->
<form><field-visibility>
<show id="scr:title" force="true" />
</field-visibility>
<appearance>
<field id="scr:title">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
<!-- Document Library pop-up Edit Metadata form -->
<form id="doclib-simple-metadata"><field-visibility>
<!-- <show id="cm:name" />-->
<show id="scr:title" force="true" /></field-visibility>
<edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
<appearance>
<field id="scr:title">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
<!-- Document Library Inline Edit form -->
<form id="doclib-inline-edit"><field-visibility>
<show id="scr:title" force="true" />
</field-visibility>
<appearance>
<field id="scr:title">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>
Sorry for my english
10-27-2016 11:26 AM
I see a form configured for existing model-type nodes (evaluator="node-type") but I do not see a form configured for new nodes (evaluator="model-type"). Can you add a model-type definition and see if that fixes it?
Also, a small side-note: You are defining your types in the "scr" namespace, which you do not own. Instead of:
<namespace uri="http://www.someco.com/model/ratings/1.0" prefix="scr" />
You should replace that uri with something that you own and then change the prefix. If you put your types in other people's namespace you run the risk of a collision.
10-27-2016 11:26 AM
I see a form configured for existing model-type nodes (evaluator="node-type") but I do not see a form configured for new nodes (evaluator="model-type"). Can you add a model-type definition and see if that fixes it?
Also, a small side-note: You are defining your types in the "scr" namespace, which you do not own. Instead of:
<namespace uri="http://www.someco.com/model/ratings/1.0" prefix="scr" />
You should replace that uri with something that you own and then change the prefix. If you put your types in other people's namespace you run the risk of a collision.
11-03-2016 09:58 AM
Jeff Potts I wonder if you know how many folks have someco namespaces stuff in their production environments? Your tutorials are awesome, thank you for helping so many people!
11-03-2016 10:47 AM
Thanks for that, Bindu, it's my pleasure. I see "Someco" and "Optaros" and
"Jeff Potts" in production models a lot which is simultaneously flattering
and confounding!
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.