@Button(list = "manage-attachments", key = "ok", order = 1, type = Button.TYPE_PRIMARY) @RequiresPermissions(level = AccessLevel.VIEW, permissions = { PERMISSION_EDIT }) public Resolution saveAttachments() { if(downloadable == null) { downloadable = new String[0]; } if(textConfiguration == null) { textConfiguration = new TextConfiguration(); } for(Attachment attachment : textConfiguration.getAttachments()) { boolean contained = ArrayUtils.contains(downloadable, attachment.getId()); attachment.setDownloadable(contained); } saveConfiguration(textConfiguration); return cancel(); }
@Button(list = "configuration", key = "update.configuration", order = 1, type = Button.TYPE_PRIMARY) @RequiresPermissions(level = AccessLevel.DEVELOP) @RequiresAuthentication public Resolution updateConfiguration() throws IOException { prepareConfigurationForms(); readPageConfigurationFromRequest(); boolean valid = validatePageConfiguration(); if (valid) { updatePageConfiguration(); SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully")); return cancel(); } else { return new ForwardResolution("/m/pageactions/text/configure.jsp"); } }
@Button(list = "edit-content", key = "update", order = 1, type = Button.TYPE_PRIMARY) @RequiresPermissions(level = AccessLevel.VIEW, permissions = { PERMISSION_EDIT }) public Resolution updateContent() { title = context.getRequest().getParameter("title"); title = StringUtils.trimToNull(title); if (title == null) { SessionMessages.addErrorMessage(ElementsThreadLocals.getText("title.cannot.be.empty")); return new ForwardResolution("/m/pageactions/text/edit-content.jsp"); } description = context.getRequest().getParameter("description"); description = StringUtils.trimToNull(description); Page page = pageInstance.getPage(); page.setTitle(title); page.setDescription(description); try { DispatcherLogic.savePage(pageInstance.getDirectory(), page); saveContent(); SessionMessages.addInfoMessage(ElementsThreadLocals.getText("object.updated.successfully")); } catch (Exception e) { logger.error("Could not save content for page " + pageInstance.getPath(), e); SessionMessages.addInfoMessage(ElementsThreadLocals.getText("update.failed")); } return cancel(); }