cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Site Properties

punk
Champ in-the-making
Champ in-the-making
How can I add my own custom properties to a Share Site in order to

1) Show them into the site-profile dashlet.
2) Be able to search for these new properties.

Thanks in advance.
21 REPLIES 21

billerby
Champ on-the-rise
Champ on-the-rise
Hi,

I guess this could be done in multiple ways. I would have done it this way:

1. Create a new site preset, for my new "site type". (My intepretation is that you want multiple sites with this configuration since the properties should be searchable)
2. Create an aspect containing your new custom properties.
3. Create a behaviour that listens to onCreateNode when type is st:site and adds the aspect to the node if its of your new presetType.
4. Fork the Site-profile dashlet and append your new properties, and include a link to and edit form for the properties (configure the form for your aspect in share-config-custom.xml)
5. Configure the the advanced search to have a form for your aspects with your custom properties.

Good luck
/Erik

Hi,

How listens to onCreateNode without modifying original source


thanks

punk
Champ in-the-making
Champ in-the-making
Thank you for the reply.
Now I am able to add custom properties because Alfresco provide support for this.
If you look at
<alfresco-root>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\dashlets\site-profile.get.html.ftl
can you see that the template handle custom property.

It is possible to customize the advanced search results so that they link directly to the site dashboard and not at the site folder into the repository?

Or I have to write a webscript for doing that?

billerby
Champ on-the-rise
Champ on-the-rise
Hi,

The custom properties you are referring to seems undocumented and if you look into the model file siteModel.xml you will find that there is a need to define the properties explicity in a model anyway. Look at the example aspect:


        <!– Example Custom Site Properties Aspect –>
      <aspect name="st:customSiteProperties">
        <title>Custom Site Properties</title>         
         <properties>
            <property name="stcp:additionalInformation">
               <title>Additional Site Information</title>
               <type>d:text</type>       
            </property>
         </properties>
        </aspect>

So you will have to make an aspect anyway, and add this aspect to the sites you want to have it (or all sites if thats your need). The advanced search will return the site as a folder, so you will probably need to make a custom implementation for the search as well. The upside in all this is the Site profile Dashlet which seems prepared to render your properties Smiley Happy

Thanks
/Erik

punk
Champ in-the-making
Champ in-the-making
exactly. you just have to add the aspect st:customSiteProperties to the site and the example works.
but I have no idea on how to customize advanced search in this way.
I think it is easier to write my own webscript or dashlet but i have no experience.

monkeydl
Champ in-the-making
Champ in-the-making
Hi guys,

I've been wandering around finding a way to add custom properties into Alfresco Share site… with little success so far.

Basically I want to be able to add an extra property call "custom properties" for the user to fill in when they create a site / edit site properties.

So far I noticed that the aspect for custom properties is there (many thanks to punk), I also managed to modify the create / edit form with the custom properties text fields…

Question is how do I save the extra form data?… I've tried adding aspect using javascript in the create-site.js but doesn't yield any result.

I'm obviously new to alfresco share and have no clue what to do next so I'd appreciate any help I can get.

Cheers,
Hung

monkeydl
Champ in-the-making
Champ in-the-making
Hello… umm just wonder if anybody read my previous post?

Can anybody please help me? Many thanks

punk
Champ in-the-making
Champ in-the-making
Hi monkeydl.
If you want to add custom property to your site,that will be visible on the Site Profile Dashlet you have to add the "st:customSiteProperties" aspect (or another custom aspect made by yourself) to your site.
In order to do this you can
a)  add st:customSiteProperties on the visible aspects (working into the web-extension folder) and than add it by hand(or with a rule) to your site home-folder space using share interface.
b)  modify the type "st:site" into the siteModel.xml adding "st:customSiteProperties" to the mandatory aspects.


I hope this is helpful.
It 's been a long time when I did.
Unfortunately I see that in this forum you can not get no help, even at smart requests. No one ever responds.

Good luck.

afaust
Legendary Innovator
Legendary Innovator
Unfortunately I see that in this forum you can not get no help, even at smart requests. No one ever responds.

I find that hard to believe. There are a lot of people - Alfresco staff, partners and community members - who are actively trying to keep up with new questions / posts as best as possible. Sometimes - since answering posts is not our primary profession - there may be a delay of a few days until an answer is provided, and in other instances, a topic may be rather fart from the common practice, so that the people coming accross a post had not had to deal with such a request / use case before and thus can't give advice from the top of their hats.

Regarding this thread, a general tip I would give is to not post new / additional questions in a thread / conversation that is older than a couple of days. As stated above, the focus is on new posts / threads for which there is a special filter. No one can be expected to go through all threads / conversations that already had a lively exchange and look for follow-ups. There is simply to much going on in the forum.


Back to topic:

From my experience - I implemented custom site properties for a customer a while ago - you need to enhance your data model, for which punk has already provided the necessary steps. When we implemented custom properties, we chose to adapt the create-site.get.html.ftl, edit-site.get.html.ftl, sites.post.json.js and site.put.json.js to provide the necessary UI additons in the established UI dialogs as well as actually maintain the properties. This was needed for the seamless inclusion our customer at that time required.

You could also - as a) and b) of punks last post hinted at - use the Repository view in Share and your configured edit-form for st:site to edit these properties. This should work without any modification to a web script as the Forms API takes care of all load / persistence automatically based on your configuration. All you need to do is to ensure the aspect is already applied or force the aspect related properties to be shown in the form via the force attribute in field-visibility.