Alfresco custom model with sys:base as parent is having property cm:name - alfresco

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.

Related

Is it possible to inherit cm:folder properties to its content in alfresco?

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

Maximo Anywhere 7.6 - Adding additional field to a list item - Error: Cannot add an item to layout

We are trying to add a field in the SR List screen of Service Request app. We are able to see the additional field's data in the response and see the value in the detail screen. But the same is not visible in the list screen even after we made changes in the WorkListItem.xml. When we looked at the developer logs, we saw an error as below.
Cannot add an item to layout [generated_application_ui_layout_small_WorkListItem_0]. Position [item7] does not exist.
We executed build.xml and also artifact-processor.xml. But if is of no use as we are still getting the error.
Below are code snippets added in the app.xml & WorkListItem.xml.
app.xml
<listItemTemplate id="ServiceRequest.MyReportedSR_serviceRequest_listItemTemplate_WorkListItem" layout="WorkListItem">
.
.
<listtext id="ServiceRequest.MyReportedSR_serviceRequest_WorkListItem_internalpriority" layoutInsertAt="item7" resourceAttribute="internalpriority"/>
</listItemTemplate>
WorkListItem.xml
<layout>
.
.
<row id="row_3">
<column colspan="10" columnid="item7" id="item7_column"/>
</row>
</layout>
Please let us know if we are missing any steps.
Regards,
Karthik
The layoutInsertAt field should point to the id within the layout which is id="item7_column", not "item7".
It looks like the standard Service Requests app has issue when it is referring the Worklistitem layout xml. I have found that there is field mapped to item2 in app.xml but item2 is not present in the layout xml.
I have created a custom layout file copied from the WorkListItem and provided a different name. It worked after referring the new layout xml which included item2(For existing field) and item7 (New Field which we wanted to display) added in the layout xml.

Change root element in association picker control in Alfresco Share

I'm using Alfresco Share 4.2c and I have to change a root node of an association picker. When I change some property of my document I want that picker directly points to the folder where my document is placed (parent of my document).
My problem is how to access nodeRef of document from association.ftl. I think that one solution is to use page.url.args.nodeRef, find his parent and add pass it to parameter rootNode. I'm not satisfied with that because it works only if I'm on Edit metadata page and my clients also what to use popup window to manage properties which appears on click Edit Properties link.
In that case I don't have nodeRef of document in url.
Do you have any idea how to solve this?
The best way is to a NodeLocator fur such purposes: http://docs.alfresco.com/4.1/concepts/node-locator-intro.html
the ancestor NodeLocator should be sufficient for your needs. Try the following setting in your form configuration:
<field id="my:association">
<control>
<control-param name="startLocation">{ancestor}</control-param>
</control>
</field>

Allow Anonymous users to add Dexterity objects

I have a Dexterity-based container that holds inside a Dexterity-based item. I need to let Anonymous users to add objects of this type inside the container.
I already created a rolemap.xml file with the following:
<?xml version="1.0"?>
<rolemap>
<permissions>
<permission name="my.package: Add My Type" acquire="True">
<role name="Anonymous"/>
</permission>
</permissions>
</rolemap>
I declared the permission on configure.zcml:
<permission
id="my.package.AddMyType"
title="my.package: Add My Type"
/>
and finally I added a custom add view like this one:
class MyAddView(dexterity.AddForm):
grok.name('MyType')
grok.require('my.package.AddMyType')
the form is already showing up for anonymous users but, when I press the save button I'm redirected to the login form.
also, logged in users are also able to see the form and this is supposed not to be happening.
what else I have to do?
thanks to David Glick, who guided me, I ended up with a very simple solution involving the add method of the AddForm class:
class MyAddView(dexterity.AddForm):
grok.name('MyType')
grok.require('my.package.AddMyType')
def update(self):
# check here if the user is anonymous and raise exception if not
super(AddView, self).update()
def add(self, object):
container = aq_inner(self.context)
addContentToContainer(container, object, checkConstraints=False)
self.immediate_view = container.absolute_url()
to understand it better, you may want to take a look at the original code in plone.dexterity.
one important thing you may also note is that you probably need to fix your workflow permissions to remove Owner role from some of them, or you could end with content editable by anonymous users also.

Change link in contents listing for custom content type

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.

Resources