NIHVIVO-3772 NIHVIVO-3721 Incorporate the OpenSocial integration from Eric Meeks at CTSI, UCSF. Add instructions on how to install and configure ORNG Shindig.
This commit is contained in:
parent
dfb955f39f
commit
f4e5c31aa8
13 changed files with 1851 additions and 1 deletions
|
@ -2,9 +2,15 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.individual;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONException;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
|
@ -22,6 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
|||
import edu.cornell.mannlib.vitro.webapp.web.beanswrappers.ReadOnlyBeansWrapper;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
|
||||
import edu.ucsf.vitro.opensocial.OpenSocialManager;
|
||||
import freemarker.ext.beans.BeansWrapper;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
@ -33,6 +40,9 @@ import freemarker.template.TemplateModelException;
|
|||
* TODO clean this up.
|
||||
*/
|
||||
class IndividualResponseBuilder {
|
||||
private static final Log log = LogFactory
|
||||
.getLog(IndividualResponseBuilder.class);
|
||||
|
||||
private static final Map<String, String> namespaces = new HashMap<String, String>() {{
|
||||
put("display", VitroVocabulary.DISPLAY);
|
||||
put("vitro", VitroVocabulary.vitroURI);
|
||||
|
@ -78,6 +88,24 @@ class IndividualResponseBuilder {
|
|||
//If special values required for individuals like menu, include values in template values
|
||||
body.putAll(getSpecialEditingValues());
|
||||
|
||||
// VIVO OpenSocial Extension by UCSF
|
||||
try {
|
||||
OpenSocialManager openSocialManager = new OpenSocialManager(vreq,
|
||||
itm.isEditable() ? "individual-EDIT-MODE" : "individual", itm.isEditable());
|
||||
openSocialManager.setPubsubData(OpenSocialManager.JSON_PERSONID_CHANNEL,
|
||||
OpenSocialManager.buildJSONPersonIds(individual, "1 person found"));
|
||||
body.put(OpenSocialManager.TAG_NAME, openSocialManager);
|
||||
if (openSocialManager.isVisible()) {
|
||||
body.put("bodyOnload", "my.init();");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
log.error("JSONException in doTemplate()", e);
|
||||
} catch (IOException e) {
|
||||
log.error("IOException in doTemplate()", e);
|
||||
} catch (SQLException e) {
|
||||
log.error("SQLException in doTemplate()", e);
|
||||
}
|
||||
|
||||
String template = new IndividualTemplateLocator(vreq, individual).findTemplate();
|
||||
|
||||
return new TemplateResponseValues(template, body);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.search.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -51,6 +52,7 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory;
|
|||
import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult.IndividualSearchResult;
|
||||
import edu.ucsf.vitro.opensocial.OpenSocialManager;
|
||||
|
||||
/**
|
||||
* Paged search controller that uses Solr
|
||||
|
@ -268,7 +270,24 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
|||
vreq.getServletPath(), pagingLinkParams));
|
||||
}
|
||||
|
||||
String template = templateTable.get(format).get(Result.PAGED);
|
||||
// VIVO OpenSocial Extension by UCSF
|
||||
try {
|
||||
OpenSocialManager openSocialManager = new OpenSocialManager(vreq, "search");
|
||||
// put list of people found onto pubsub channel
|
||||
List<String> ids = OpenSocialManager.getOpenSocialId(individuals);
|
||||
openSocialManager.setPubsubData(OpenSocialManager.JSON_PERSONID_CHANNEL,
|
||||
OpenSocialManager.buildJSONPersonIds(ids, "" + ids.size() + " people found"));
|
||||
body.put("openSocial", openSocialManager);
|
||||
if (openSocialManager.isVisible()) {
|
||||
body.put("bodyOnload", "my.init();");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("IOException in doTemplate()", e);
|
||||
} catch (SQLException e) {
|
||||
log.error("SQLException in doTemplate()", e);
|
||||
}
|
||||
|
||||
String template = templateTable.get(format).get(Result.PAGED);
|
||||
|
||||
return new TemplateResponseValues(template, body);
|
||||
} catch (Throwable e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue