use of org.springframework.web.portlet.ModelAndView in project uPortal by Jasig.
the class PortletEntityTranslationController method postPortletTranslation.
@ResourceMapping
@RequestMapping(params = "action=postTranslation")
public ModelAndView postPortletTranslation(@RequestParam("id") String portletId, @RequestParam("locale") String locale, ResourceRequest request) throws Exception {
final IPortletDefinition definition = portletDefinitionDao.getPortletDefinition(portletId);
if (definition != null) {
definition.addLocalizedTitle(locale, request.getParameter("title"));
definition.addLocalizedName(locale, request.getParameter("name"));
definition.addLocalizedDescription(locale, request.getParameter("description"));
portletDefinitionDao.savePortletDefinition(definition);
}
return new ModelAndView("json");
}
use of org.springframework.web.portlet.ModelAndView in project uPortal by Jasig.
the class PortletEntityTranslationController method getEntityList.
@ResourceMapping
@RequestMapping(params = "action=getEntityList")
public ModelAndView getEntityList() throws Exception {
final List<IPortletDefinition> portletDefs = portletDefinitionDao.getPortletDefinitions();
final List<TranslatableEntity> entities = new ArrayList<TranslatableEntity>();
for (IPortletDefinition portletDef : portletDefs) {
TranslatableEntity entity = new TranslatableEntity();
entity.setId(portletDef.getPortletDefinitionId().getStringId());
entity.setTitle(portletDef.getTitle());
entities.add(entity);
}
return new ModelAndView("json", "entities", entities);
}
use of org.springframework.web.portlet.ModelAndView in project uPortal by Jasig.
the class SearchPortletController method showSearchForm.
/** Display a search form */
@RequestMapping
public ModelAndView showSearchForm(RenderRequest request, RenderResponse response) {
final Map<String, Object> model = new HashMap<>();
// Determine if this portlet displays the search launch view or regular search view.
PortletPreferences prefs = request.getPreferences();
final boolean isMobile = isMobile(request);
String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search";
// If this search portlet is configured to be the searchLauncher, calculate the URLs to the indicated
// search portlet.
final String searchLaunchFname = prefs.getValue(SEARCH_LAUNCH_FNAME, null);
if (searchLaunchFname != null) {
model.put("searchLaunchUrl", calculateSearchLaunchUrl(request, response));
model.put("autocompleteUrl", calculateAutocompleteResourceUrl(request, response));
viewName = "/jsp/Search/searchLauncher";
}
return new ModelAndView(viewName, model);
}
use of org.springframework.web.portlet.ModelAndView in project uPortal by Jasig.
the class BaseStatisticsReportController method renderAggregationReport.
/**
* @param form The form submitted by the user
* @return The model and view to render
*/
protected final ModelAndView renderAggregationReport(F form) throws TypeMismatchException {
final DataTable table = buildAggregationReport(form);
final String view;
switch(form.getFormat()) {
case csv:
{
view = "dataTableCsvView";
break;
}
case html:
{
view = "dataTableHtmlView";
break;
}
default:
{
view = "json";
}
}
ModelAndView modelAndView = new ModelAndView(view, "table", table);
String titleAugmentation = getReportTitleAugmentation(form);
if (StringUtils.isNotBlank(titleAugmentation)) {
modelAndView.addObject("titleAugmentation", getReportTitleAugmentation(form));
}
return modelAndView;
}
use of org.springframework.web.portlet.ModelAndView in project uPortal by Jasig.
the class MessageEntityTranslationController method getEntity.
@ResourceMapping
@RequestMapping(params = "action=getEntity")
public ModelAndView getEntity(@RequestParam("id") String code, @RequestParam("locale") String localeStr) {
final Locale locale = LocaleManager.parseLocale(localeStr);
final Message message = messageDao.getMessage(code, locale);
return new ModelAndView("json", "message", message);
}
Aggregations