Creating content of custom type in Share - alfresco

I am trying to have Share let the user create new documents based on a custom type I implemented (see the excellent documentation here )
I had the type implemented and defined aspects, but I can't see a clear way to configure Share in order to propose in the interface my type for a new document.
I guess it should be added to the Create content menu option that lists available types.
Thanks

You should just modify the share-config-custom.xml file in your tomcat/shared/classes/alfresco/web-extension folder (if there is no such file, search for a similar sample file and rename it). There, you should put something like this in the <config evaluator="string-compare" condition="DocumentLibrary" replace="true"> tag:
<types>
<type name="custom:myType" />
</types>
Just remember if the replace parameter is true, you will override every type visible, so maybe it's better to turn it to false.
Hope it helps

I managed to have it working by adding the following section to the share-custom-config.xml file:
<config evaluator="string-compare" condition="DocumentLibrary">
<create-content>
<content id="plain-text" mimetype="text/plain" label="Brand new content type" itemid="sc:doc"/>
</create-content>
</config>

Related

How can I easily override SEO Sulu CMS page extension in Symfony?

I want to override the SeoStructureExtension with my own implementation, which will support OpenGraph (OG) tags.
What is the easiest way to override it and add additional inputs?
I am afraid to say that overriding the SeoStructureExtension file can not be achieved very easily... The fields it saves are hardcoded. So the first thing you would have to do is override the sulu_page.extension.seo service, which references this class. I would say your best bet to achieve this, is to decorate this service.
The other part you have to extend is the XML file describing the page_seo form. Luckily this part is a little bit easier. Your Sulu installation should already come with a config/forms folder, where you can put a file similar to the original page_seo form. Give it the same key (page_seo) and only add the new fields you want to add (the name of the properties have to match what you are implementing in the decorated service). If you e.g. want to add a new text field, this file would look something like this:
<?xml version="1.0" ?>
<form xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd"
>
<key>page_seo</key>
<properties>
<property name="ext/seo/ogTitle" type="text_line">
<meta>
<title lang="en">OG Title</title>
</meta>
</property>
</properties>
</form>
Mind the ext/seo/ prefix before ogTitle, which is need for the information to be passed to the SeoStructureExtension.
I also think that these fields might make sense to be added to the core of Sulu. I would be happy if you create an issue, explaining what fields exactly you need etc. Then we can discuss if we implement it in the core as well, so that you don't have to add this manually in future versions.

Alfresco Share 3.3 - How do I get my new custom type to appear in the Create Content drop down?

I have created a custon type. I can create a Plain Text content item in Alfresco Share and Convert Type to my custom type (my:foo). So far so good.
But, how can I add my custom type to the Create Content drop down?
I tried this by creating $TOMCAT/shared/classes/alfresco/extension/web-client-config-custom.xml
<alfresco-config>
<config evaluator="string-compare" condition="Content Wizards">
<content-types>
<type name="my:foo" />
</content-types>
</config>
</alfresco-config>
But this has not helped. Any ideas?
You haven't specified exact version (3.3a through 3.3g), there are lots of changes from minor to minor version.
Take a look at this topic, you could use some hints.

Custom type not showing up in rule config

Trying to add a folder rule which should specialize cm:content to our custom type my:content (which inherits from cm:content).
We have configured the following in share-config-custom.xml:
<type name="cm:content">
<subtype name="my:content"/>
</type>
Our type shows up correctly in the specialize type action in the document library, but when trying to specify a rule the listbox that should contain our type remains empty. :(
What could we be missing?
You need to add to web-client-config-custom.xml in alfresco/extension
<config evaluator="string-compare" condition="Action Wizards"
replace="true">
<subtypes>
<type name="my:content" />
</subtypes>
<specialise-types>
<type name="my:content" />
</specialise-types>
</config>
And then the trick is to provide title & description for the types in the content model or via messages/properties; otherwise they will not be there.
Wrote about similar issues here: http://experiencewithalfresco.blogspot.dk/2012/08/remember-to-define-title-and.html
For adding custom messages you need to create custom-message-context.xml
<beans>
<bean id="mycompany.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.custom</value>
</list>
</property>
Then create custom.properties file and place it in /shared/classes/alfresco/message folder.
And for adding custom type to rule your config should be working only thing to make sure is config inside which you have put sub-type related config is proper.
Disclaimer: This answer is for Alfresco 6.2.2+.
Answering an old thread. For me, I tried this thread all vague answers on Alfresco Hub and nothing worked out.
I have been through this nightmare. Its frustrating and I don't know why Alfresco team relies on "Display Label" instead of "Name".
As shown in the screenshot, I was missing Display Label. As soon as I edited my custom type and provided Display Label, all worked as expected.
If I would have designed it, I would include, Name and Display Label both in the drop down in my rule window.
Hope it helps someone like me.

How to override popup.pt in Plone?

I was able to modify the original popup.pt and see changes in my instance, but when I try to override it by copying and renaming to archetypes.referencebrowserwidget.browser.popup.pt in my theme/(add-in) overrides folder I am unable to see my changes.
I overrode the path_bar class viewlet, following this tutorial. I attempted to follow the same logic for overriding popup.pt, but I was unable to get Plone to see the file in my configure.zcml.
configure.zcml:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="mytheme.theme">
<includeDependencies package="." />
<plone:static
directory="resources"
type="theme"
/>
<genericsetup:registerProfile
name="default"
title="mytheme.theme"
directory="profiles/default"
description="Installs the mytheme.theme package"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
<browser:viewlet
name="plone.path_bar"
manager="plone.app.layout.viewlets.interfaces.IAboveContent"
class=".customizations.PathBarViewlet"
permission="zope2.View"
layer=".interfaces.IMyTheme"
/>
<browser:page
name="login_main_template"
for="*"
permission="zope.Public"
template="login_main_template.pt"
/>
</configure>
While searching for a solution I found this Stackoverflow question - How to customize the popup.pt template from archetypes.referencebrowserwidget?. I added/:
<include package="z3c.jbot" file="meta.zcml" />
<browser:jbot directory="jbot_templates" layer=".browser.interfaces.IThemeSpecific" />
to my configure.zcml and removed the browser:viewlet from my previous attempt but I was still unable to get Plone to see my overview.
Which method do I need to use to override, the class viewlet, the z3c.jbot, or just the standard copy/rename method? I have read thru the Plone documentation multiple times, but still unable to resolve my issue. If I need to post any additional files please let me know.
Thanks in advance.
The z3c.jbot approach usually just works fine.
You have to be sure, that the file you place into to your jbot_templates folder has the right name.
The path to the popup.pt is archetypes/referencebrowserwidget/browser/popup.pt,
So in your case the filename must be archetypes.referencebrowserwidget.browser.popup.pt
Please make sure that your browserlayer .interfaces.IMyTheme is active on your site -> browserlayer.xml

Is it possible to create a constraint based on another defined type in Alfresco?

I can find anything that would suggest this is possible or otherwise I have the following declared models.
The product:
<type name="syn:produit">
<title>Produit</title>
<parent>cm:cmobject</parent>
<properties>
<!-- properties defined -->
</properties>
</type>
product order:
<type name="syn:produitCommande">
<title></title>
<parent>cm:object</parent>
<properties>
<propert name="productType">
</property>
</properties>
</type>
I would like to constraint the productType of the syn:produitCommande to a list of syn:produit. Is it possible to do this OOTB (I think no is the answer to that), I have seen example codes of dynamic constraints but a lot of "That's a bad idea" warnings that goes with the code. I need advice on how to proceed with resolving this issue with possible code examples. (Not entirely understood the text on how to build the custom constraint yet.)
Fist to answer your question, there is No XML config where you can configure that.
A DB example from the forum is here
I probably wouldn't make a custom constraint if it's only for UI usage.
My approach would be to make a custom form control (in share) which loads a search (through Ajax in json format) from the Repository.
It really is bad idea.
There will be various problems as with each type fix set of properties attached so you cannot configure this thing though model for sure.
I think you have a requirement where you don't want to fix the type of document on creation.
you want to provide the option to user to allow change type of document after it is created right?In that case you can create all your custom content types in model and there is one action called change type in alfresco share which you can configure to showup all your custom content types.In that way even after creating the content you will be able to change its content type.

Resources