public static String makeUserDisplayName( String userId ) { String userDisplayName = NULL_STRING; userDisplayName = rb.getFormattedMessage("udp.unregistered", userId); return userDisplayName; }
public String getSourceText(String[] parameter) { if (isHasParameters()) { return rl.getFormattedMessage(getDatabaseSourceKey(), parameter); } return sourceText; }
/** * @inheritDoc */ protected String getTag(String title, boolean shouldUseHtml) { if (shouldUseHtml) { return rb.getFormattedMessage("noti.tag.html", new Object[]{ServerConfigurationService.getString("ui.service", "Sakai"), ServerConfigurationService.getPortalUrl(), title}); } else { return rb.getFormattedMessage("noti.tag", new Object[]{ServerConfigurationService.getString("ui.service", "Sakai"), ServerConfigurationService.getPortalUrl(), title}); } }
public String getSizeLabel(ContentEntity entity) { String label = null; if(entity instanceof ContentResource) { byte[] collectionId = null; ContentResource resource = (ContentResource) entity; try { collectionId = resource.getContent(); if(collectionId != null) { CitationCollection collection = getCollection(new String(collectionId)); String[] args = new String[]{ Integer.toString(collection.size())}; label = rb.getFormattedMessage("citation.count", args); } } catch(Exception e) { String citationCollectionId = "null"; if(collectionId != null) { citationCollectionId = collectionId.toString(); } M_log.warn("Unable to determine size of CitationCollection for entity: entityId == " + entity.getId() + " citationCollectionId == " + collectionId + " exception == " + e.toString()); } } return label; }
@EntityCustomAction(action = "ping", viewKey = EntityView.VIEW_SHOW) public String handlePing(EntityReference ref) { User currentUser = userDirectoryService.getCurrentUser(); User anon = userDirectoryService.getAnonymousUser(); if(anon.equals(currentUser)) { throw new SecurityException("You must be logged in to use this service"); } String userId = ref.getId(); try { String email = userDirectoryService.getUser(userId).getEmail(); new EmailSender(email, rb.getFormattedMessage("email.subject", new String[]{service}), rb.getFormattedMessage("email.body", new String[]{currentUser.getDisplayName(), service, portalUrl})); } catch(Exception e) { throw new EntityException("Failed to send email",userId); } return "success"; }
session.put(FilePickerHelper.FILE_PICKER_INSTRUCTION_TEXT, rl.getFormattedMessage( instructionKey, new Object[]{fieldLabel, limit}));
buffer.append(rb.getFormattedMessage("noti.releasegrade.text", new String[]{a.getTitle(), linkToToolInSite}));
buffer.append(rb.getFormattedMessage("noti.releaseresubmission.text", new String[]{a.getTitle(), linkToToolInSite})); buffer.append(rb.getFormattedMessage("noti.releaseresubmission.noresubmit.text", new String[]{a.getTitle(), linkToToolInSite}));
retval = new String("0" + rb.getFormattedMessage("error.link.placement.update", new Object[]{id})); M_log.warn(this + " cannot add page and basic lti tool to site " + siteId); retval = new String("0" + rb.getFormattedMessage("error.link.placement.update", new Object[]{id})); M_log.warn(this + " cannot find site " + contentSite);
public void validate(Object obj, Errors errors) { if (obj instanceof StructuredArtifactDefinitionBean) { StructuredArtifactDefinitionBean artifactHome = (StructuredArtifactDefinitionBean) obj; if (PICK_SCHEMA_ACTION.equals(artifactHome.getFilePickerAction()) || PICK_TRANSFORM_ACTION.equals(artifactHome.getFilePickerAction()) || PICK_ALTCREATEXSLT_ACTION.equals(artifactHome.getFilePickerAction()) || PICK_ALTVIEWXSLT_ACTION.equals(artifactHome.getFilePickerAction())) { return; } if ((artifactHome.getSchemaFile() == null || artifactHome.getSchemaFile().getValue() == null || artifactHome.getSchemaFile().getValue().length() == 0) && artifactHome.getSchema() == null) { errors.rejectValue("schemaFile", "errors.required", myResources.getFormattedMessage("errors.required", new Object[]{myResources.getString("schemaFile")})); } if (artifactHome.getDocumentRoot() == null || artifactHome.getDocumentRoot().length() == 0) { errors.rejectValue("documentRoot", "errors.required", myResources.getFormattedMessage("errors.required", new Object[]{myResources.getString("docRootNode")})); } if (artifactHome.getDescription() == null || artifactHome.getDescription().length() == 0) { errors.rejectValue("description", "errors.required", myResources.getFormattedMessage("errors.required", new Object[]{myResources.getString("name")})); } } } }
buf.append(rb.getFormattedMessage("noti.header.add", new Object[]{title, url})); buf.append(rb.getFormattedMessage("noti.header.update", new Object[]{title, url}));
if (SyllabusService.EVENT_SYLLABUS_POST_NEW.equals(function)) returnedString =rb.getFormattedMessage("event.syllabus.post.new", new Object[]{title, syllabusName}); returnedString =rb.getFormattedMessage("event.syllabus.post.changed", new Object[]{title, syllabusName}); returnedString =rb.getFormattedMessage("event.syllabus.post.delete", new Object[]{title, syllabusName});
buf.append(FormattedText.convertFormattedTextToPlaintext(rb.getFormattedMessage("noti.header.add", new Object[]{title,url}))); buf.append(FormattedText.convertFormattedTextToPlaintext(rb.getFormattedMessage("noti.header.update", new Object[]{title,url})));
if ( retval instanceof String ) { return rb.getFormattedMessage("error.link.placement.update", new Object[]{retval}); return new String(rb.getFormattedMessage("error.link.placement.update", new Object[]{key.toString()}));
/** * Access a text string suitable for use as a very brief description of a particular resource. * If the string is more than about 40 or 50 characters, it may be truncated at an arbitrary * length. The string may identify the type of this resource or more specific information. * The string should be localized. If no value is supplied, a default hover-string will be * used. * * @param member The resource that's being displayed * @return i18n label of the form type */ public String getLocalizedHoverText(ContentEntity member) { String formName = ""; if (member != null) { StructuredArtifactDefinitionBean home = getStructuredArtifactDefinitionManager().loadHome( (String)member.getProperties().get(ResourceProperties.PROP_STRUCTOBJ_TYPE)); if (home != null) { formName = home.getDescription(); } } return rb.getFormattedMessage("form_item_tip", new Object[]{formName}); }
public String initializeAction(Reference reference) { ToolSession toolSession = SessionManager.getCurrentToolSession(); toolSession.setAttribute(PermissionsHelper.TARGET_REF, reference.getReference()); // use the folder's context (as a site and as a resource) for roles Collection<String> rolesRefs = new ArrayList<String>(); rolesRefs.add(SiteService.siteReference(reference.getContext())); rolesRefs.add(reference.getReference()); toolSession.setAttribute(PermissionsHelper.ROLES_REF, rolesRefs); // ... with this description String title = reference.getProperties().getProperty(ResourceProperties.PROP_DISPLAY_NAME); String[] args = { title }; toolSession.setAttribute(PermissionsHelper.DESCRIPTION, rb.getFormattedMessage("title.permissions", args)); // ... showing only locks that are prpefixed with this toolSession.setAttribute(PermissionsHelper.PREFIX, "content."); return BaseInteractionAction.getInitializationId(reference.getReference(), this.getTypeId(), this.getId()); }
/** * {@inheritDoc} */ public String getEntityDescription(Reference ref) { // double check that it's mine if (!APPLICATION_ID.equals(ref.getType())) return null; String rv = rb.getFormattedMessage("entdsc.sit", new Object[]{ref.getReference()}); try { Site site = getSite(ref.getId()); rv = rb.getFormattedMessage("entdsc.sit_usr", new Object[]{ site.getTitle() + " (" + site.getId() + ")", site.getCreatedTime().toStringLocalFull(), site.getCreatedBy().getDisplayName() + " (" + site.getCreatedBy().getDisplayId() + ")", StringUtil.limit((site.getDescription() == null ? "" : site.getDescription()), 30)}); } catch (IdUnusedException e) { } catch (NullPointerException e) { } return rv; }
rv = "\"" + rb.getFormattedMessage("sitdis.usr", new Object[]{userName}) + "\" " + rv;
return rb.getFormattedMessage((contentHostingService.EVENT_RESOURCE_AVAILABLE.equals(function) ? "db.subj.new" : "db.subj.upd"), args);
/** * Format the announcement notification subject line. * * @param event * The event that matched criteria to cause the notification. * @return the announcement notification subject line. */ protected String getSubject(Event event) { // get the message Reference ref = entityManager.newReference(event.getResource()); AnnouncementMessage msg = (AnnouncementMessage) ref.getEntity(); AnnouncementMessageHeader hdr = (AnnouncementMessageHeader) msg.getAnnouncementHeader(); // use either the configured site, or if not configured, the site (context) of the resource String siteId = (getSite() != null) ? getSite() : ref.getContext(); // get a site title String title = siteId; try { Site site = siteService.getSite(siteId); title = site.getTitle(); } catch (Exception ignore) { } // use the message's subject return rb.getFormattedMessage("noti.subj", new Object[]{title, hdr.getSubject()}); }