Displaying custom metadata in Alfresco - alfresco

I was able to add custom aspects to documents in order to set custom properties.
The next step for me would be to have a local instance of Alfresco displaying the custom properties and having them editable so that users can change their values via the web pages.
There's a good link on wiki.alfresco that describes just that and I followed the instructions, but it's not working for me.
In short, I added a custom aspect called my:customAspect like this:
AlfrescoDocument alfDoc = ... // get existing document
alfDoc.addAspect("P:my:customAspect");
// set additional properties
Map<String, Object> propertiesEnum = new HashMap<String, Object>();
properties.put("my:score", 152);
...
alfDoc.updateProperties(updateProperties);
The properties were correctly added and I can see their values either programatically or by using Apache Chemistry Workbench desktop client.
In order to have the additional properties visible in Alfresco Web client, I updated the web-client-config-custom.xml file by setting:
<config evaluator="aspect-name" condition="my:customAspect">
<property-sheet>
<show-property name="my:score"/>
</property-sheet>
</config>
Unfortunately, I can't see this property listed in the Alfresco web (including the /share one) for the documents on whom I added the custom aspect.
Maybe I'm missing something, maybe there are some other xml files that should be updated.
Any help appreciated.
Thanks

Unfortunately, viewing custom aspect properties is not supported in Share.
If you need to show these props you have to include them in the form defined for a particular type.
You could use this little help.

Related

How do I enable old style collections in my Plone 4.3.9 site?

Can I use old style collections rather than the new collection? If so, how?
Go to http://[HOST]/[PLONESITE_ID]/##types-controlpanel?type_id=Topic, check the box where it says "Globally addable" and hit the "Apply Changes" on bottom of the form.
Programatically reproducable by adding /profiles/default/Topic.xml to your addon with the following content:
<object name="Topic">
<!-- Enable old-style-collections
By default turned off since >= Plone-4.1 -->
<property name="global_allow">True</property>
</object>
To turn off the new-style-collections, you can do the same procedure, just replace "Topic" with "Collection" and set "global_allow" to False.
If you also want be able to define which fields are available as a choosable criterion in a collection's edit-mode, via the site's UI, go to http://[HOST]/[PLONESITE_ID]/portal_controlpanel/manage_editActionsForm and check "Collections (old style)" entry, then "Collections (old style)" will become visible for configuration in the site's controlpanel, accessible via http://[HOST]/[PLONESITE_ID]/##overview-controlpanel.
Also these settings can be reproduced programatically via a profiles/default/portal_atct, you can export the relevant xml-file via http://[HOST]/[PLONESITE_ID]/portal_setup/manage_main, or have a look at this example for an orientation: https://raw.githubusercontent.com/ida/adi/master/adi.tickets/adi/tickets/profiles/default/portal_atct.xml
Note: In case you are adding new fields as criteria here, you'll need to register them in the catalogue also, via profiles/default/catalog.xml, another example for that case: https://github.com/ida/adi/blob/master/adi.tickets/adi/tickets/profiles/default/catalog.xml
Furthermore: If you want to allow visitors to change the criteria's values to search for, on the fly via the UI – a search-form in other words – look at collective.formcriteria, written by Ross Patterson.

Create custom metadata Tags for documents to be uploaded in Alfresco

I am exploring with alfresco 4.3 & 5.0,
As we know our normal documents have metadata properties like Author,Title,Subject,Category.... & so on.
So if it has some values, alfresco retrieves data values from these & displays in that file properties section like :Name,Title,Author,size,creator......and many more.
So Suppose If I have a some more form fields in my document (like firstName,Tenant,isAuthrorized), then what are the all steps that I need to follow in alfresco so that whenever user will upload any document , under that file properties section, all the properties will get displayed and also If I will select edit properties option, I should be able to edit them.
I have followed this pdf :http://ecmarchitect.com/images/articles/alfresco-content/content-article...
By using which I am able to see new drop-down values under create rule section.
Similar way I want to do it document properties section, so that similar to existing properties like Name, Title,Description,MimeType,Tags... etc , I can also see my new properties like firstName,Tenant - all are text fields.
Please show me the way to achieve these things for Alfresco 5.0 a community . To achieve this do I need to import Alfresco sdk, or can I directly changes in tomcat?
Also one more question, I want to create a custom metadata in alfresco , so that if excel sheet(column)have values ,then all such properties with their values should be displayed under properties section of that file.
Is it possible in alfresco?
If yes can you provide me some way to do it.
You can create custom metadata in alfresco.For that in alfresco you can use alfresco content model.For reference you can study below link of alfresco.
https://wiki.alfresco.com/wiki/Data_Dictionary_Guide
Below are some basic information.
You will need to create 2 files for creating custom metadata.
1. Context file
2. Model file
Both files will be inside alfresco/extension folder.
There is one another approach for dynamic model creation.For that you only need to create one file which you will need to upload inside "/Data Dictionary/Models"

Plone setuphandler- In a setuphandler, how can I programatically add/create a folderish content type at root of Plonesite?

I have have made a folderish content type called supplier_folder, which displays a list of suppliers that can be added under it, and their information. I can add it through the navigation bar, but I would like to add it programatically during setup.
I have been following the tutorial on custom installer code (http://docs.plone.org/develop/addons/components/genericsetup.html#custom-installer-code-setuphandlers-py) and have looked at creating objects programatically (http://docs.plone.org/develop/plone/content/creating.html).
Unfortunately, the second article says I need to have a folder created. How can I get around this and add the supplier_folder object at the Plone Site outside of a folder?
IIRC, only users with role Manager or Site Administrator can add content to the root of the site; you can overcome this limitation in two ways:
by using the _constructInstance method as it bypasses the permissions when creating an item
by switching roles inside your code with plone.api.env.adopt_roles
I personally prefer the second one.
you can see an example of a pretty complex setuphandlers.py in interlegis.portalmodelo.policy package.
When you create a new Plone site, it's also creating some default content types.
Look at how Plone do: https://github.com/plone/Products.CMFPlone/blob/1471828ee97a8dd84396bad4a3286be514819869/Products/CMFPlone/setuphandlers.py#L119
There are a couple of ways to achieve this. The buildin mechanism is to use GenericSetup in combination with "structure" folder as described here: http://koansys.com/tech/create-plone-initial-content-with-generic-setup
In short you need the following:
Create a folder "structure" in your Generic Setup profile (in general, under profiles/default)
Create a .objects file with the following content: "suppliers,supplier_folder"
in "structure" create a folder "suppliers" with a .properties file and content:
[DEFAULT]
title = Suppliers
description = Some usefull description text
As far as I remember this is ok for simple structures likes your. If you have complex structures with folders and sub-folders and want more specific control you probably need to write python code. I made some stuff here: https://github.com/collective/zettwerk.setup/blob/master/zettwerk/setup/structure.py
But zettwerk.setup is not yet released, but you should be able to integrate the structure.py right into your project. Than you can the handle_structure method into your setuphandlers.py and passing a structure dict like this:
handle_structure(portal, [{'id': 'suppliers', 'portal_type': 'supplier_folder'}])
The advantage of this method is, that you can also control metadata like workflow state, default page setting, portlets, local roles and some others.

How to customize dexterity-through-the-web-content view?

I created a content in my Plone 4.3 site (no grok here) with the very nice Dexterity through-the-web editor. Now I'd like to customize the default view for this content.
I've read Martn Aspelli's book but the problem is that through-the-web content does'nt have a specific interface (so I can't use it to create my specific view).
If you want to do this all through-the-web, then do the following:
Create a template for your view in the "custom" folder of
portal_skins (through the ZMI). You'll probably want to start with a
copy of something like the page template
(portal_skins/plone_content/document_view). Give it a name like
your_content_type_view. Test it by appending /your_content_type_view
to the URL for a sample object.
Edit the Factory Type Information (portal_types/your_content_type/Default
view method) to be your_content_type_view.
What you will have done is create a skin-level view for the type. This is different from the browser views that Martin is discussing, which do indeed require a class. The Dexterity development team is working on a way to provide TTW maintenance of browser views, but that's for a later version of Plone.
Meanwhile, if you later transfer your Dexterity content type to a Python add on, you'll be able to use your template, possibly unmodified for a browser view.

Sharepoint: Custom SiteMapProvider for custom list

I need to customise the title property for SiteMapNodes.
I am using WSS, and have created a custom document library. While navigating through this library I want to change the names of the nodes in the breadcrumb displayed above the list name.
So far I have:
created a class inheriting from
System.Web.SiteMapProvider,
added my class to the web.config,
changed the sharepoint
default.master page sitemappath (in
PlaceHolderTitleBreadcrumb) to point
to my new site map provider.
I then overwrote the CurrentNode property to edit the CurrentNode.title with the desired name.
My problem is all the previous nodes (parent nodes) revert back to their original names. How do I edit the breadcrumb so that all the nodes navigated through keep their new title?
Any advice or direction would be appreciated.
The way I've done this before isn't by creating a new SiteMapProvider, but by replacing the sealed SharePoint AspMenu control with MossMenu (the same as AspMenu but open sourced by the SharePoint team). I then overrode OnMenuItemDataBound with the behaviour I needed.
If you need/prefer to use SiteMapProvider, have you tried using Reflector or the new .NET Framework debugging support to see how it works? There must be somewhere in the SiteMapProvider code where your overridden changes are, in turn, also being overridden. :-)

Resources