Search in sources :

Example 6 with ModelAndView

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");
}
Also used : ModelAndView(org.springframework.web.portlet.ModelAndView) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition) ResourceMapping(org.springframework.web.portlet.bind.annotation.ResourceMapping) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with ModelAndView

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);
}
Also used : ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.portlet.ModelAndView) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition) ResourceMapping(org.springframework.web.portlet.bind.annotation.ResourceMapping) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with ModelAndView

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);
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ModelAndView(org.springframework.web.portlet.ModelAndView) PortletPreferences(javax.portlet.PortletPreferences) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with ModelAndView

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;
}
Also used : DataTable(com.google.visualization.datasource.datatable.DataTable) ModelAndView(org.springframework.web.portlet.ModelAndView)

Example 10 with 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);
}
Also used : Locale(java.util.Locale) Message(org.apereo.portal.i18n.Message) ModelAndView(org.springframework.web.portlet.ModelAndView) ResourceMapping(org.springframework.web.portlet.bind.annotation.ResourceMapping) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ModelAndView (org.springframework.web.portlet.ModelAndView)15 HashMap (java.util.HashMap)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 PortletPreferences (javax.portlet.PortletPreferences)6 ResourceMapping (org.springframework.web.portlet.bind.annotation.ResourceMapping)6 RenderMapping (org.springframework.web.portlet.bind.annotation.RenderMapping)4 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)3 IPerson (org.apereo.portal.security.IPerson)3 ArrayList (java.util.ArrayList)2 Locale (java.util.Locale)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Message (org.apereo.portal.i18n.Message)2 DataTable (com.google.visualization.datasource.datatable.DataTable)1 List (java.util.List)1 PortletSession (javax.portlet.PortletSession)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 DataSource (javax.sql.DataSource)1