I have created model in which I have defined an aspect with a property currently its type is text.
<property name="alfrescoDocs:sugarurl">
<title>SugarCrm URL</title>
<description>SugarCRM URL</description>
<type>d:text</type>
</property>
I have successfully attached this aspect with document and update its property. but my requirement is to attach hyper link (anchor tag) with document as property. can any body help me how to do this. Thanks in Advance.
Related
I want to add a property inside an aspect in the Alfresco content model applicationModel.xml.
How can this be done?
<aspect name="app:linked">
<title>Marker aspect to indicate that the node has been linked.</title>
</aspect>
Below property shouldbe addded inside above aspect.
<properties>
<property name="app:links">
<title>Links:::</title>
<type>d:noderef</type>
<multiple>true</multiple>
</property>
</properties>
Never update the out-of-the-box Alfresco content models. You are asking for trouble.
In this case, extend the content model with your own content model in its own namespace, then use it to define a new aspect that has the property you need, then add that aspect to the object instances as needed.
I have created a custom model with parent as sys:base and modified the share-config-custom.xml so that I can create the content from the share. After creating the content from share am unable to see the content in share or explore. Instead am getting the below error when checking from document details page.
The item cannot be found. Either you do not have permissions to view the item, it has been removed or it never existed.
In Node browser I can see cm:name in the property field. But as per the alfresco svn, sys:base is not having the property cm:name.
<type name="sys:base">
<title>Base</title>
<mandatory-aspects>
<aspect>sys:referenceable</aspect>
<aspect>sys:localized</aspect>
</mandatory-aspects>
</type>
Can someone please tell how the custom model get the cm:name property?
Also I want to delete the content. Is there any way to delete that content from share or explore?
Thanks in advance!
To delete your content, call the webscript
/slingshot/doclib/action/aspects/node/{store_type}/{store_id}/{id}
and send the sys:temporary as an argument.
I have the following in my model.xml
<type name="abc:Policy">
<title>abc Policy</title>
<parent>cm:folder</parent>
<archive>true</archive>
<mandatory-aspects>
<aspect>abc:policyProperties</aspect>
</mandatory-aspects>
</type>
abc:policyProperties has the following.
<aspect name="abc:policytProperties">
<title>abc Policy Properties</title>
<properties>
<property name="abc:dated">
<title>Dated</title>
<type>d:date</type>
</property>
</properties>
</aspect>
A user can upload a document to the abc:Policy folder. But there is no reference to that document currently in the model. How to make it possible for any document within this folder to inherit abc:dated and display it within its properties in Alfresco-share?
It sounds like what you want to do is have a document inherit a property value from the same-named property on the document's parent folder.
One way to do this would be to write a folder rule in JavaScript that reads the property and sets it on a document. You can configure the rule to do that when the document is created or when it is updated.
Here's a quick example that does this with the out-of-the-box cm:title property:
var title = document.parent.properties['cm:title'];
if (title != undefined) {
document.properties['cm:title'] = title;
document.save();
}
You can put that script in a file called "inherit-title.js" under Data Dictionary/Scripts, then configure your rule to execute the script. Any time a new object is created in that folder it will get the current title.
You can modify this to work with your content model.
Note that unless you configure the rule to work on updates, the value on the child will never be updated. So if the title changes in the folder it will not change in its children. And if a child is changed it will not pull the latest value from the parent. You could get that to happen through some rule config and script tweaks, but be mindful of the performance cost.
If you wanted to make this happen more universally, i.e., without setting this up as rules on individual folders, you could write a behavior to do it (tutorial).
If you refer to alfresco content model definitions contentModel.xml
you will find that, cm:folder has default child association cm:contains for the type sys:base. So you are able to add node of type that extends sys:base.
Each document added to your folder abc:Policy goes as a child. And the aspect is applied to parent i.e. abc:Policy. So abc:dated is a property of abc:Policy and not of the document.
One thing you can do is, define one more type that extends cm:content and add is as a child association to your abc:Policy also apply the aspect to it, then you can get the abc:dated as a property of your document
How do i reorder fields that inherited from an existing behavior within a fields definition that i wrote my self.
For example I want to use the leadimage field (behavior) from plone.app.contenttypes but instead of having it at the bottom of all fields i defined, i want to have it after the description.
I've tried like this:
<property name="model_source">
<model xmlns:security="http://namespaces.plone.org/supermodel/security"
xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
xmlns:form="http://namespaces.plone.org/supermodel/form"
xmlns="http://namespaces.plone.org/supermodel/schema">
<schema>
<field name="image" type="plone.namedfile.field.NamedBlobImage" form:after="description">
<title>Image</title>
</field>
</schema>
</model>
</property>
and btw. is there a more readable way to do this?
form.order_after(image1='ILeadImage.image')
that did the trick, was a little confused within the code example...
followup question:
if i have 3 image field with each having a caption field, do i really have to add that line to every field itself? or is there a way to set the order for all fields in one place like with the fieldset definition?
I never have tried this using XML but the Dexterity XML documentation says it's possible; check the after/before attributes.
I think you can have more control using Python code; check the Form schema hints documentation.
I have created a custom content type, based on the existing 'Image' type.
When I look at the contents tab of a parent folder, actual images have a link like this:
.../arumsans/arumsans.png/view
Where my type has a link like this:
.../arumsans/bold
And when clicked shows only the image in the browser.
How can I modify the way these links are made so that my type has
.../arumsans/bold/view
or
.../arumsans/bold/edit
You need to list your type in the typesUseViewActionInListings property of the site_properties property sheet in the portal_properties tool.
To do this manually, navigate to the ZMI, find the tool and click on it, then click on the site_properties sheet, then find the typesUseViewActionInListings entry and add the portal_type of your custom type in that list.
To automate this, add a propertiestool.xml file to the GenericSetup profile of your package that defines the type, and make sure it contains the following:
<?xml version="1.0"?>
<object name="portal_properties" meta_type="Plone Properties Tool">
<object name="site_properties" meta_type="Plone Property Sheet">
<property name="typesUseViewActionInListings" type="lines">
<element value="YourCustomPortalType"/>
</proyerty>
</object>
</object>
(with your portal_type value filled in) and re-import the profile.