Using customized content model in JavaScript code

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2013 06:19 PM
I'm coding in JavaScript (a .js file at space Data Dictionary/Scripts) and it's necessary to use some customized properties. The code runs fine when using the alfresco.org/model/content/ (cm
that don't need be explicit, but my "dataprev.gov.br/model/contentModelNotaTec" (notatec
does. How to do it? For example:
if (document.properties.title == "Restrito")
{
<code>
}
runs OK, but
if (document.properties.tipoAcesso == "Restrito") //meaning {http://dataprev.gov.br/model/contentModelNotaTec/1.0}tipoAcesso
{
<code>
}
does not.
I'm sure it's necessary to put "notatec:" at some place in this line, but where?
A more general question: How to know the content modeling of a document? In this example, the contentModelNotaTec.xml file has the lines:
<model name="notatec:contentModelNotaTec"
…
<namespaces>
<namespace uri="http://www.dataprev.gov.br/model/contentModelNotaTec/1.0" prefix="notatec"/>
</namespaces>
…
Which document property does save this information or method return it?
Thanks for any help,


if (document.properties.title == "Restrito")
{
<code>
}
runs OK, but
if (document.properties.tipoAcesso == "Restrito") //meaning {http://dataprev.gov.br/model/contentModelNotaTec/1.0}tipoAcesso
{
<code>
}
does not.
I'm sure it's necessary to put "notatec:" at some place in this line, but where?
A more general question: How to know the content modeling of a document? In this example, the contentModelNotaTec.xml file has the lines:
<model name="notatec:contentModelNotaTec"
…
<namespaces>
<namespace uri="http://www.dataprev.gov.br/model/contentModelNotaTec/1.0" prefix="notatec"/>
</namespaces>
…
Which document property does save this information or method return it?
Thanks for any help,
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2013 06:27 PM
The correct syntax is as follows:
Hope this helps.
document.properties["notatec:tipoAcesso"] = "Restrito";
Hope this helps.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2013 08:35 PM
use the short form
as Parzgnat said or use fully qualifed namespace form
if(document.properties["notatec:tipoAcesso"] == "Restrito"){}
as Parzgnat said or use fully qualifed namespace form
if(document.properties["{http://www.alfresco.org/model/content/1.0}tipoAcesso"] == "Restrito"){}
