03-21-2012 10:52 AM
<script type="text/javascript">//<![CDATA[
new Alfresco.widget.DashletResizer("${args.htmlid}", "${instance.object.id}");
function getjson(e){
var name = e.id;
var scriptURL = "/RedTree/emaillist?company=" + name + "&format=json";
alert(scriptURL);
var connector = remote.connect("alfresco");
alert ("connector ok");
var json = connector.call(scriptURL);
if (json.status == 200) {
var obj = eval('(' + json + ')');
alert('done');
}else {
alert('failed');
}
}
//]]></script>
<div class="dashlet">
<div class="title">${msg("header")}</div>
<p style="color:green;font-size:10px;font-weight:bold;">Click a company to view the memberlist with contact details.</p>
<div class="body scrollableList" <#if args.height??>style="height: ${args.height}px;"</#if>>
<div class="detail-list-item first-item last-item">
<#list result.companylist as company>
<a id="${company.companyname}" href = "#" onclick="getjson(this);">${company.companyname}</a>
</#list>
</div>
</div>
</div>
03-21-2012 07:52 PM
03-22-2012 06:47 AM
javax.servlet.ServletException: Could not resolve view with name 'user/admin/alfresco/services/RedTree/emaillist' in servlet with name 'Spring Surf Dispatcher Servlet'
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/ajax/yahoo/connection/connection-min.js"> </script>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/ajax/common.js"> </script>
<script type="text/javascript">//<![CDATA[
new Alfresco.widget.DashletResizer("${args.htmlid}", "${instance.object.id}");
//]]></script>
<script type="text/javascript">
function getjson(e){
alert('start');
var name = e.id;
var scriptURL = "alfresco/services/RedTree/emaillist?company=" + name + "&format=json";
alert(scriptURL);
YAHOO.util.Connect.asyncRequest("GET", scriptURL,
{
success: handleInfo,
failure: handleErrorYahoo
},
null);
}
function handleInfo(response) { alert('succes' + response.responseText);}
function handleErrorYahoo(response) { alert('failed…' + response.responseText);}
</script>
<div class="dashlet">
<div class="title">${msg("header")}</div>
<p style="color:green;font-size:10px;font-weight:bold;">Click a company to view the memberlist with contact details.</p>
<div class="body scrollableList" <#if args.height??>style="height: ${args.height}px;"</#if>>
<div class="detail-list-item first-item last-item">
<#list result.companylist as company>
<a id="${company.companyname}" href = "#" onclick="getjson(this);">${company.companyname}</a>
</#list>
</div>
</div>
</div>
function main() {
var companyname = args.company;
var query = "TYPE:\"{http://www.alfresco.org/model/content/1.0}person\" AND @cm\\:organization:\"" + companyname + "\"";
var userList = search.luceneSearch(query);
var length = userList.length;
eval("model.userList = userList");
eval("model.company = companyname");
}
main();
<#escape x as jsonUtils.encodeJSONString(x)>
{ "${company}":
[
<#list userList as child>
{
"firstname": "${child.properties.firstName}",
"lastname": "${child.properties.lastName}",
"email": "${child.properties.email}"
}
<#if !(child == userList?last)>,</#if>
</#list>
]
}
</#escape>
03-22-2012 07:03 AM
var scriptURL = "alfresco/services/RedTree/emaillist?company=" + name + "&format=json";
to:var scriptURL = Alfresco.constants.PROXY_URI + "RedTree/emaillist?company=" + name + "&format=json";
03-22-2012 07:22 AM
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.