cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript API & CMIS for Atom Feeds

nancygaillard
Champ on-the-rise
Champ on-the-rise
Hi,

Alfresco 4.2.e on Windows 7 x64bits

I had recently post this => <a href="http://forums.alfresco.com/forum/developer-discussions/other-apis/javascript-api-variable-site-dashl...">Javascript API - variable "site" for dashlet</a>

I am progressing thanks to the community. It is really slow, because of my ignorance on Alfresco…
and I have some difficulties to find informations.

My problem now is to access properties of my datalists (title, path…)
Currently, I have a dashlet which works Smiley Happy I can see my datalists but only by name and not by title and my links direct towards atom feeds and not towards the datalists 😕

How to access to properties?

There is my code, my simplified atomFeed.XML and my list of atom functions :
datalists-list.get.js
<javascript>
var rep = remote.call("/cmis/p/Sites/gestion/dataLists/children");//?format=json cause an error
var lists = [];

if(rep.status == 200){
   var feed = atom.toFeed(rep);
   var size = feed.getEntries().size();
   
   for(var i=0; i < size ; i++){
      var entry = feed.getEntries().get(i);
      lists = entry;
   }
}
model.lists = lists;
</javascript>

datalists-list.get.html.ftl

<@markup id="js">
   <#– Your JavaScript file. You actually only need the my-dashlet-min.js file (unless in development mode), but we usually keep the original source in my-dashlet.js there so we can change it later.–>
   <@script type="text/javascript" src="${url.context}/res/components/dashlets/datalists-list.js" group="dashlets"/>
</@>
<@markup id="html">
  <@uniqueIdDiv>
      <div class="dashlet">
         <div class="title">Lites d'appels et de courriers</div>
         <div class="body scrollableList">
            <#if lists?size != 0>
               <#list lists as l>
                  <div class="detail-list-item">
                     <div class="details">
                        <#assign links = l.getLinks()>
                        <#list links[1..1] as link><a href="${link.href}">${l.title} (${length})</a></#list>
                     </div>
                  </div>
               </#list>
               <div class="">
               </div>
            <#else>
               Il n'y a pas de liste disponible
            </#if>
         </div>
      </div>
   </@>
</@>

2 REPLIES 2

nancygaillard
Champ on-the-rise
Champ on-the-rise
Atom Feed XML

<entry>
   <cmisra:object>
      <cmis:properties>
         <cmis:propertyString queryName="cmis:path" displayName="Path" propertyDefinitionId="cmis:path">
            <cmis:value>/Sites/gestion/dataLists/a006d3e3-0922-4252-95b3-6614381b1e55</cmis:value>
         </cmis:propertyString>
         <cmis:propertyId queryName="cmis:objectTypeId" displayName="Object Type Id" propertyDefinitionId="cmis:objectTypeId">
            <cmis:value>F:dl:dataList</cmis:value>
         </cmis:propertyId>
         <cmis:propertyString queryName="cmis:name" displayName="Name" propertyDefinitionId="cmis:name">
            <cmis:value>a006d3e3-0922-4252-95b3-6614381b1e55</cmis:value>
         </cmis:propertyString>
      </cmis:properties>
</cmisra:object>
</entry>


Functions of atom object :
<java>
toAtom:function toAtom() {/* org.apache.abdera.model.Element toAtom(java.lang.String) org.apache.abdera.model.Element toAtom(org.springframework.extensions.surf.util.Content) */}
notifyAll:function notifyAll() {/* void notifyAll() */}
toFeed:function toFeed() {/* org.apache.abdera.model.Feed toFeed(java.lang.String) org.apache.abdera.model.Feed toFeed(org.springframework.extensions.surf.util.Content) */}
createQName:function createQName() {/* javax.xml.namespace.QName createQName(java.lang.String,java.lang.String) */}
equals:function equals() {/* boolean equals(java.lang.Object) */}
notify:function notify() {/* void notify() */}
createEntry:function createEntry() {/* org.apache.abdera.model.Entry createEntry() */}
toEntry:function toEntry() {/* org.apache.abdera.model.Entry toEntry(org.springframework.extensions.surf.util.Content) org.apache.abdera.model.Entry toEntry(java.lang.String) */}
class:class org.springframework.extensions.webscripts.atom.AtomService
names:null
toMimeType:function toMimeType() {/* java.lang.String toMimeType(org.apache.abdera.model.Entry) */}
createFeed:function createFeed() {/* org.apache.abdera.model.Feed createFeed() */}
setAbderaService:function setAbderaService() {/* void setAbderaService(org.springframework.extensions.webscripts.atom.AbderaService) */}
wait:function wait() {/* void wait(long,int) void wait(long) void wait() */}
toString:function toString() {/* java.lang.String toString() */}
hashCode:function hashCode() {/* int hashCode() */}
toService:function toService() {/* org.apache.abdera.model.Service toService(org.springframework.extensions.surf.util.Content) org.apache.abdera.model.Service toService(java.lang.String) */}
abderaService:undefined
getClass:function getClass() {/* java.lang.Class getClass() */}
getNames:function getNames() {/* java.util.Map getNames() */}
</java>

nancygaillard
Champ on-the-rise
Champ on-the-rise
The solution

Go to 
http://localhost:8081/alfresco/s/slingshot/datalists/lists/site/gestion/dataLists
(in my case : datalists in my Site named Gestion
It return a JSON with the list of datalists ^^

Use JSON like this :

datalists-list.get.js
<javascript>
var rep = remote.call("/slingshot/datalists/lists/site/gestion/dataLists");
var lists = [];
if(rep.status == 200){
   var json = eval('('+rep+')');
   lists = json["datalists"];
}
model.lists = lists;
</javascript>

datalists-list.get.html.ftl

<@markup id="js">
   <#– Your JavaScript file. You actually only need the my-dashlet-min.js file (unless in development mode), but we usually keep the original source in my-dashlet.js there so we can change it later.–>
   <@script type="text/javascript" src="${url.context}/res/components/dashlets/datalists-list.js" group="dashlets"/>
</@>
<@markup id="html">
  <@uniqueIdDiv>
      <div class="dashlet">
         <div class="title">Lites d appels et de courriers</div>
         <div class="body scrollableList">
            <#if lists?size != 0>
               <#list lists as l>
                  <div class="detail-list-item">
                     <div class="details">
                        <a href="/share/page/site/gestion/data-lists?list=${l.name}">${l.title}</a>
                     </div>
                  </div>
               </#list>
               <div class="">
               </div>
            <#else>
               Il n y a pas de liste disponible
            </#if>
         </div>
      </div>
   </@>
</@>
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.