cancel
Showing results for 
Search instead for 
Did you mean: 

Editable create date

ajshaw
Champ in-the-making
Champ in-the-making
Hi. I wan't to temporarily make the create date and modified date fields editable. This is because the use of webdav has destroyed some metadata.


<show-property name="created" read-only="false" show-in-edit-mode="true" /> 

results in some drop down lists being shown to select the date, but it's greyed out and un-editable.  Can anyone help?  Thankyou.
3 REPLIES 3

dschmalz
Champ in-the-making
Champ in-the-making
Hi. I wan't to temporarily make the create date and modified date fields editable. This is because the use of webdav has destroyed some metadata.


<show-property name="created" read-only="false" show-in-edit-mode="true" /> 

results in some drop down lists being shown to select the date, but it's greyed out and un-editable.  Can anyone help?  Thankyou.

If you look at the definition of the the "created" property in the content model (contentModel.xml), you will find the following:


   <aspect name="cm:auditable">
         <title>Auditable</title>
         <properties>
            <property name="cm:created">
               <title>Created</title>
               <type>d:datetime</type>
               <protected>true</protected>
               <mandatory enforced="true">true</mandatory>
            </property>
            <property name="cm:creator">
               <title>Creator</title>
               <type>d:text</type>
               <protected>true</protected>
               <mandatory enforced="true">true</mandatory>
            </property>
            <property name="cm:modified">
               <title>Modified</title>
               <type>d:datetime</type>
               <protected>true</protected>
               <mandatory enforced="true">true</mandatory>
            </property>
            <property name="cm:modifier">
               <title>Modifier</title>
               <type>d:text</type>
               <protected>true</protected>
               <mandatory enforced="true">true</mandatory>
            </property>
            <property name="cm:accessed">
               <title>Accessed</title>
               <type>d:datetime</type>
               <protected>true</protected>
            </property>
         </properties>
      </aspect>

In other terms, the "cm:created" property is protected, which, from my understanding, means that once it has been set, it cannot be updated. This is a good practice because if you want to perform audit, you cannot afford that some code changes this value. You can probably disable temporarily the protection by changing this file and restart Alfresco, although I would not recommend it.

David

ajshaw
Champ in-the-making
Champ in-the-making
Thanks alot.

I'll try that out. Meanwhile i have been using a freemarker template with a javascript script to change the create dates. This doesn't give me the nice dropdown date selectors (although i could make one i suppose), but it actually worked out easier because i can see all the documents i need to change in one view, rather than having to navigate to the properties page of each individual content item.

It seems that the protected data items can be altered programatically. I guess that the purpose of the protection is a second layer of defence as far as the web client is involved, in adition to simply specifying whether the property is read only in edit mode.

Cheers.

dschmalz
Champ in-the-making
Champ in-the-making
Thanks for the additional info regarding the metadata  Smiley Happy
David