Java Code Examples for org.apache.commons.lang.StringEscapeUtils#escapeJavaScript()

The following examples show how to use org.apache.commons.lang.StringEscapeUtils#escapeJavaScript() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JacketImageTag.java    From website with GNU Affero General Public License v3.0 6 votes vote down vote up
public void doTag() throws JspException, IOException {
	if (productId != null) {
		product = Product.find(productId);
	}
	if (product == null) {
		throw new JspException("Product or ProductId must be specified");
	}
	if (StringUtils.isEmpty(title)) {
		title = product.getTitle();
	}
	if (StringUtils.isEmpty(alt)) {
		alt = product.getTitle();
	}
	String image = "<img";
	if (hasCustomImageUrl()) {
		image += " width=\"100\"";
	}
	image += " src=\"" + getImageSrc() + "\"";
	image += " alt=\"" + StringEscapeUtils.escapeJavaScript(alt) + "\"";
	image += " title=\"" + StringEscapeUtils.escapeJavaScript(product.getTitle()) + "\"";
	image += "/>";
	getJspContext().getOut().println(image);
}
 
Example 2
Source File: Neo4JDb.java    From knowledge-extraction with Apache License 2.0 6 votes vote down vote up
private Node getNode(Label label, String key, Object value) {
	Node node = null;
	try (Transaction tx = graphDb.beginTx()) {
		ResourceIterator<Node> nodes = null;
		if (label != null){
			nodes = graphDb.findNodesByLabelAndProperty(
				label, key, value).iterator();
		}
		else {
			String validValue = StringEscapeUtils.escapeJavaScript((String) value);
			ExecutionEngine engine = new ExecutionEngine(graphDb);
			nodes = engine.execute(
					"START n=node(*)"
					+ " WHERE n." + key + "=\"" + validValue + "\""
					+ " RETURN n").columnAs("n");
			
		}
		if (nodes.hasNext()) {
			node = nodes.next();
		}
		nodes.close();
	}
	return node;
}
 
Example 3
Source File: QuotaResponseBuilderImpl.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
@Override
public boolean updateQuotaEmailTemplate(QuotaEmailTemplateUpdateCmd cmd) {
    final String templateName = cmd.getTemplateName();
    final String templateSubject = StringEscapeUtils.escapeJavaScript(cmd.getTemplateSubject());
    final String templateBody = StringEscapeUtils.escapeJavaScript(cmd.getTemplateBody());
    final String locale = cmd.getLocale();

    final List<QuotaEmailTemplatesVO> templates = _quotaEmailTemplateDao.listAllQuotaEmailTemplates(templateName);
    if (templates.size() == 1) {
        final QuotaEmailTemplatesVO template = templates.get(0);
        template.setTemplateSubject(templateSubject);
        template.setTemplateBody(templateBody);
        if (locale != null) {
            template.setLocale(locale);
        }
        return _quotaEmailTemplateDao.updateQuotaEmailTemplate(template);
    }
    return false;
}
 
Example 4
Source File: ControlFilePreProcessor.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
private boolean runDbSpinUpScripts(String tenantId) {

        String jsEscapedTenantId = StringEscapeUtils.escapeJavaScript(tenantId);
        String dbName = TenantIdToDbName.convertTenantIdToDbName(jsEscapedTenantId);

        LOG.info("Running tenant indexing script for tenant: {} db: {}", tenantId, dbName);
        boolean result = MongoCommander.ensureIndexes(INDEX_SCRIPT, dbName, batchJobDAO.getMongoTemplate()) == null;
        
        LOG.info("Running tenant presplit script for tenant: {} db: {}", tenantId, dbName);
        result &= MongoCommander.preSplit(shardCollections, dbName, batchJobDAO.getMongoTemplate()) == null;

        if (result) {
            tenantDA.setTenantReadyFlag(tenantId);
        }

        return result;
    }
 
Example 5
Source File: AssessmentEscapeUtils.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static void escapeQuotesInQuestionResult(AssessmentQuestionResult questionResult) {
String answerString = questionResult.getAnswerString();
if (answerString != null) {
    String answerStringEscaped = StringEscapeUtils.escapeJavaScript(answerString);
    questionResult.setAnswerStringEscaped(answerStringEscaped);
}

AssessmentQuestion question = questionResult.getAssessmentQuestion();
String title = question.getTitle();
if (title != null) {
    String titleEscaped = StringEscapeUtils.escapeJavaScript(title);
    question.setTitleEscaped(titleEscaped);
}

for (AssessmentQuestionOption option : question.getOptions()) {
    String questionStr = option.getQuestion();
    if (questionStr != null) {
	String questionEscaped = StringEscapeUtils.escapeJavaScript(questionStr);
	option.setQuestionEscaped(questionEscaped);
    }

    String optionStr = option.getOptionString();
    if (optionStr != null) {
	String optionEscaped = StringEscapeUtils.escapeJavaScript(optionStr);
	option.setOptionStringEscaped(optionEscaped);
    }
}
   }
 
Example 6
Source File: NotebookEntryDTO.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public NotebookEntryDTO(NotebookEntry entry) {
this.uid = entry.getUid();
this.entry = entry.getEntry();
if (this.entry != null) {
    this.entryEscaped = StringEscapeUtils.escapeJavaScript(this.entry);
}
this.createDate = entry.getCreateDate();
this.lastModified = (entry.getLastModified() == null) ? entry.getCreateDate() : entry.getLastModified();
   }
 
Example 7
Source File: NotebookUserDTO.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public NotebookUserDTO(NotebookUser user, NotebookEntry entry) {
this.uid = user.getUid();
this.loginName = user.getLoginName();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.finishedActivity = user.isFinishedActivity();
this.entryUID = user.getEntryUID();
if (user.getTeachersComment() != null) {
    this.teachersComment = StringEscapeUtils.escapeJavaScript(user.getTeachersComment());
}
this.entryDTO = new NotebookEntryDTO(entry);
   }
 
Example 8
Source File: NotebookUserDTO.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public NotebookUserDTO(NotebookUser user) {
this.uid = user.getUid();
this.loginName = user.getLoginName();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.finishedActivity = user.isFinishedActivity();
this.entryUID = user.getEntryUID();
if (user.getTeachersComment() != null) {
    this.teachersComment = StringEscapeUtils.escapeJavaScript(user.getTeachersComment());
}
   }
 
Example 9
Source File: MonitoringController.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
    * Populate user jqgrid table on summary page.
    */
   @RequestMapping("/userMasterDetail")
   public String userMasterDetail(HttpServletRequest request) {

Long userUid = WebUtil.readLongParam(request, McAppConstants.USER_UID);
McQueUsr user = mcService.getMcUserByUID(userUid);
List<McUsrAttempt> userAttempts = mcService.getFinalizedUserAttempts(user);

// Escapes all characters that may brake JS code on assigning Java value to JS String variable (particularly
// escapes all quotes in the following way \").
if (userAttempts != null) {
    for (McUsrAttempt userAttempt : userAttempts) {
	McQueContent question = userAttempt.getMcQueContent();
	McOptsContent option = userAttempt.getMcOptionsContent();

	String questionText = question.getQuestion();
	if (questionText != null) {
	    String escapedQuestion = StringEscapeUtils.escapeJavaScript(questionText);
	    question.setEscapedQuestion(escapedQuestion);
	}

	String optionText = option.getMcQueOptionText();
	if (optionText != null) {
	    String escapedOptionText = StringEscapeUtils.escapeJavaScript(optionText);
	    option.setEscapedOptionText(escapedOptionText);
	}
    }
}

request.setAttribute(McAppConstants.ATTR_CONTENT, user.getMcSession().getMcContent());
request.setAttribute(McAppConstants.USER_ATTEMPTS, userAttempts);
request.setAttribute(McAppConstants.TOOL_SESSION_ID, user.getMcSession().getMcSessionId());
return "monitoring/masterDetailLoadUp";
   }
 
Example 10
Source File: ScratchieServiceImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
   public List<ReflectDTO> getReflectionList(Long contentId) {
ArrayList<ReflectDTO> reflections = new ArrayList<>();

// get all available leaders associated with this content as only leaders have reflections
List<ScratchieSession> sessionList = scratchieSessionDao.getByContentId(contentId);
for (ScratchieSession session : sessionList) {

    ScratchieUser leader = session.getGroupLeader();
    if (leader != null) {
	NotebookEntry notebookEntry = getEntry(session.getSessionId(), CoreNotebookConstants.NOTEBOOK_TOOL,
		ScratchieConstants.TOOL_SIGNATURE, leader.getUserId().intValue());
	if ((notebookEntry != null) && StringUtils.isNotBlank(notebookEntry.getEntry())) {
	    User user = new User();
	    user.setLastName(leader.getLastName());
	    user.setFirstName(leader.getFirstName());
	    ReflectDTO reflectDTO = new ReflectDTO(user);
	    reflectDTO.setGroupName(session.getSessionName());
	    String reflection = notebookEntry.getEntry();
	    reflection = StringEscapeUtils.escapeJavaScript(reflection);
	    reflectDTO.setReflection(reflection);
	    reflectDTO.setIsGroupLeader(session.isUserGroupLeader(leader.getUid()));

	    reflections.add(reflectDTO);
	}
    }
}

return reflections;
   }
 
Example 11
Source File: CrossNavigationManager.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
public static String buildCrossNavigationUrl(SpagoBICellWrapper cellWrapper, WhatIfEngineInstance ei) throws Exception {
	logger.debug("IN");
	SpagoBIPivotModel modelWrapper = ei.getSpagoBIPivotModel();
	List<TargetParameter> parameters = modelWrapper.getCrossNavigation().getParameters();

	StringBuffer buffer = new StringBuffer("parent.execExternalCrossNavigation({");
	if (!parameters.isEmpty()) {
		for (int i = 0; i < parameters.size(); i++) {
			TargetParameter aParameter = parameters.get(i);
			if (!aParameter.isAbsolute()) {// absolute will be managed from external cross navigation
				String parameterName = aParameter.name;
				String parameterValue = getParameterValue(aParameter, ei, cellWrapper);
				if (parameterValue != null && !parameterValue.equals("")) {
					parameterValue = "'" + StringEscapeUtils.escapeJavaScript(parameterValue) + "'";
				} else {
					parameterValue = "''";
				}
				if (parameterValue != null) {
					buffer.append(parameterName + ":" + parameterValue + ",");
				}
			}
		}
	}

	if (buffer.charAt(buffer.length() - 1) == ',') {
		buffer.deleteCharAt(buffer.length() - 1);
	}

	buffer.append("});");
	String toReturn = buffer.toString();
	logger.debug("OUT: returning [" + toReturn + "]");
	return toReturn;

}
 
Example 12
Source File: CrossNavigationManager.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
public static String buildClickableUrl(Member member, List<TargetClickable> targetsClickable) {
	logger.debug("IN");
	Level level = member.getLevel();
	String url = new String();
	for (TargetClickable tc : targetsClickable) {
		if (tc.getUniqueName().equalsIgnoreCase(level.getUniqueName())) {
			StringBuffer targetDocumentParameters = new StringBuffer();
			for (Map.Entry<String, String> entry : tc.getParametersList().entrySet()) {
				String key = entry.getKey();
				String value = entry.getValue();
				targetDocumentParameters.append(key);
				targetDocumentParameters.append(":");
				targetDocumentParameters.append(value);
				targetDocumentParameters.append(",");
			}

			if (targetDocumentParameters.length() > 0) {
				int index = targetDocumentParameters.lastIndexOf(",");
				targetDocumentParameters.setLength(index);
			}

			String documentParametersUnformatted = (targetDocumentParameters.toString());

			logger.debug("Composing cross nav url. Parameters unformatted = " + documentParametersUnformatted);
			String newName = getLevelValue(member, tc.getUniqueName());
			newName = "'" + StringEscapeUtils.escapeJavaScript(newName) + "'";
			Object[] args = new Object[] { newName };
			url = MessageFormat.format(documentParametersUnformatted, args);
			logger.debug("Composing cross nav url. Parameters formatted = " + url);

			url = "parent.execExternalCrossNavigation({" + (url) + "});";

			return url;
		} else {
			url = null;
		}
	}
	return url;
}
 
Example 13
Source File: CloseableCalloutWindowController.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
  * Constructor for a closable callout window controller. After calling the constructor, the callout window will be visible immediately, there is no need to activate
  * the window. In contrast to the modal dialogs you have to render the content of this controller your self with the getInitialComponent() method.
  * 
  * @param ureq
  *            The user request
  * @param wControl
  *            The window control
  * @param calloutWindowContent
  *            The component that should be displayed in the callout window
  * @param targetDomID
  *            The DOM ID of the element which the callout should pop up from.
  * @param title
  *            The title or NULL if no title should be used
  * @param closable
  *            true: show close link; false: don't show close link. Note, in any case will the callout window be close when the user clickes on the background.
  * @param cssClasses
  *            CSS classes that should be applied to the callout window or NULL to not use any css classes
  */
 public CloseableCalloutWindowController(UserRequest ureq, WindowControl wControl, Component calloutWindowContent, String targetDomID, String title, boolean closable,
         String cssClasses) {
     super(ureq, wControl);

     boolean ajax = getWindowControl().getWindowBackOffice().getWindowManager().isAjaxEnabled();
     if (ajax) {
         calloutVC = createVelocityContainer("callout");
         //
         calloutVC.put("calloutWindowContent", calloutWindowContent);
         // Target link
         setDOMTarget(targetDomID);
         // Config options, see setter methods
         calloutVC.contextPut("closable", Boolean.toString(closable));
         calloutVC.contextPut("cssClasses", (cssClasses == null ? "b_small" : cssClasses));
         if (title != null) {
             String escapedTitle = StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(title));
             calloutVC.contextPut("title", escapedTitle);
         }
         //
         putInitialPanel(calloutVC);
     } else {
         // Fallback to old-school modal dialog
         cmc = new CloseableModalController(wControl, "close", calloutWindowContent, true, title, closable);
listenTo(cmc);
         putInitialPanel(new Panel("empty"));
     }
 }
 
Example 14
Source File: VelocityRenderDecorator.java    From olat with Apache License 2.0 4 votes vote down vote up
/**
 * Escapes the characters in a String for JavaScript use.
 */
public String escapeJavaScript(String str) {
    return StringEscapeUtils.escapeJavaScript(str);
}
 
Example 15
Source File: encodeForJavascript.java    From openbd-core with GNU General Public License v3.0 4 votes vote down vote up
public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException {
	return new cfStringData( StringEscapeUtils.escapeJavaScript( getNamedStringParam(argStruct, "string", "") ) );
}
 
Example 16
Source File: JavaScriptStringEncoder.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
@Override
protected String processInternal(String value) {
    return StringEscapeUtils.escapeJavaScript(value);
}
 
Example 17
Source File: ChangeLiteral.java    From rewrite with Apache License 2.0 4 votes vote down vote up
@Override
public J visitLiteral(J.Literal literal) {
    if (isScopeInCursorPath()) {
        var transformed = transform.apply(literal.getValue());

        if (transformed == literal.getValue() || literal.getType() == null) {
            return literal;
        }

        String transformedSource;
        switch (literal.getType()) {
            case Boolean:
            case Byte:
            case Int:
            case Short:
            case Void:
                transformedSource = transformed.toString();
                break;
            case Char:
                var escaped = StringEscapeUtils.escapeJavaScript(transformed.toString());

                // there are two differences between javascript escaping and character escaping
                switch (escaped) {
                    case "\\\"":
                        transformedSource = "'\"'";
                        break;
                    case "\\/":
                        transformedSource = "'/'";
                        break;
                    default:
                        transformedSource = "'" + escaped + "'";
                }
                break;
            case Double:
                transformedSource = transformed.toString() + "d";
                break;
            case Float:
                transformedSource = transformed.toString() + "f";
                break;
            case Long:
                transformedSource = transformed.toString() + "L";
                break;
            case String:
                transformedSource = "\"" + StringEscapeUtils.escapeJava(transformed.toString()) + "\"";
                break;
            case Wildcard:
                transformedSource = "*";
                break;
            case Null:
                transformedSource = "null";
                break;
            case None:
            default:
                transformedSource = "";
        }

        return literal.withValue(transformed).withValueSource(transformedSource);
    }

    return literal;
}
 
Example 18
Source File: DevTreeHtmlGenerator.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addItemForJSTree(StringBuffer htmlStream, LowFunctionality folder, boolean isRoot) {

		String name = folder.getName();

		// String name = msgBuilder.getUserMessage(nameLabel, null, httpRequest);
		// String name = msgBuilder.getI18nMessage(nameLabel, httpRequest);
		name = StringEscapeUtils.escapeJavaScript(name);
		Integer idFolder = folder.getId();
		Integer parentId = folder.getParentId();
		boolean canExec = ObjectsAccessVerifier.canExec(idFolder, profile);
		boolean canDev = ObjectsAccessVerifier.canDev(idFolder, profile);

		if (isRoot) {
			htmlStream.append("	treeDevObjects.add(" + idFolder + ", " + dTreeRootId + ",'" + name + "', '', '', '', '', '', 'true');\n");
		} else {
			if (canDev || canExec) {
				String imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/treefolder.gif", currTheme);
				String imgFolderOp = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/treefolderopen.gif", currTheme);
				htmlStream.append("	treeDevObjects.add(" + idFolder + ", " + parentId + ",'" + name + "', '', '', '', '" + imgFolder + "', '" + imgFolderOp
						+ "', '', '');\n");
				List objects = folder.getBiObjects();
				for (Iterator it = objects.iterator(); it.hasNext();) {

					BIObject obj = (BIObject) it.next();
					String biObjType = obj.getBiObjectTypeCode();
					String imgUrl = "/img/objecticon_" + biObjType + ".png";
					String userIcon = urlBuilder.getResourceLinkByTheme(httpRequest, imgUrl, currTheme);
					String biObjState = obj.getStateCode();
					String stateImgUrl = "/img/stateicon_" + biObjState + ".png";
					String stateIcon = urlBuilder.getResourceLinkByTheme(httpRequest, stateImgUrl, currTheme);
					Integer idObj = obj.getId();
					String stateObj = obj.getStateCode();
					String prog = idObj.toString();
					// String localizedName=msgBuilder.getUserMessage(obj.getName(), SpagoBIConstants.DEFAULT_USER_BUNDLE, httpRequest);
					String localizedName = obj.getName();
					// msgBuilder.getI18nMessage(obj.getName(), httpRequest);

					localizedName = StringEscapeUtils.escapeJavaScript(localizedName);
					if (canDev && (stateObj.equals("DEV"))) {
						htmlStream.append("	treeDevObjects.add(" + dTreeObjects-- + ", " + idFolder + ",'<img src=\\'" + stateIcon + "\\' /> " + localizedName
								+ "', 'javascript:linkEmpty()', '', '', '" + userIcon + "', '', '', 'menu" + requestIdentity + "(" + prog + ", event, \\'"
								+ createExecuteObjectLink(idObj) + "\\',\\'" + createMetadataObjectLink(idObj) + "\\', \\'" + createDetailObjectLink(idObj)
								+ "\\', \\'" + createEraseObjectLink(idObj, idFolder) + "\\', \\'\\', \\'" + createMoveUpObjectLink(idObj) + "\\')' );\n");
					} else if (canExec && (stateObj.equals("REL"))) {
						htmlStream.append("	treeDevObjects.add(" + dTreeObjects-- + ", " + idFolder + ",'<img src=\\'" + stateIcon + "\\' /> " + localizedName
								+ "', 'javascript:linkEmpty()', '', '', '" + userIcon + "', '', '', 'menu" + requestIdentity + "(" + prog + ", event, \\'"
								+ createExecuteObjectLink(idObj) + "\\', \\'" + createMetadataObjectLink(idObj) + "\\', \\'\\', \\'\\', \\'\\', \\'\\')' );\n");
					}
				}
			}
		}
	}
 
Example 19
Source File: MenuConfigurationHTMLTreeGenerator.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addItemForJSTree(StringBuffer htmlStream, Menu menu, boolean isRoot) {

		String nameLabel = menu.getName();

		// String name = msgBuilder.getUserMessage(nameLabel, SpagoBIConstants.DEFAULT_USER_BUNDLE, httpRequest);
		// String name = msgBuilder.getI18nMessage(nameLabel, httpRequest);
		String name = nameLabel;

		name = StringEscapeUtils.escapeJavaScript(name);
		// String name = msgBuilder.getMessage(nameLabel, "messages", httpRequest);
		Integer id = menu.getMenuId();
		Integer parentId = menu.getParentId();
		Integer level = menu.getLevel();
		boolean hasChildren = menu.getHasChildren();
		// if(parentsList.contains(id))hasChildren=true;

		// set image icons
		// String imgFolder = urlBuilder.getResourceLink(httpRequest, "/img/treefolder.gif");
		// String imgFolderOp = urlBuilder.getResourceLink(httpRequest, "/img/treefolderopen.gif");

		String imgFolder = "";
		String imgFolderOp = "";

		if (menu.getObjId() != null) {
			// String icon=DetailMenuModule.assignImage(menu);
			if (menu.getSnapshotName() != null || menu.getSubObjName() != null) {
				imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/wapp/bullet_yellow.png", currTheme);
			} else {
				imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/wapp/bullet_blue.png", currTheme);
			}
			imgFolderOp = imgFolder;
		} else if (menu.getStaticPage() != null && !menu.getStaticPage().trim().equals("")) {
			imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/wapp/bullet_gray.png", currTheme);
			imgFolderOp = imgFolder;
		} else if (menu.getExternalApplicationUrl() != null) {
			imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/wapp/bullet_purple.png", currTheme);
			imgFolderOp = imgFolder;
		} else {
			imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/wapp/bullet_white.png", currTheme);
			imgFolderOp = imgFolder;
		}

		if (isRoot) {

			// htmlStream.append(" treeFunct.add(" + id + ", " + dTreeRootId + ",'" + name + "', 'javascript:linkEmpty()', '', '', '', '', 'true', 'menu" +
			// requestIdentity + "(event, \\'"+createAddFunctionalityLink(nameLabel)+"\\', \\'\\', \\'\\', \\'\\', \\'\\')');\n");
			if (hasChildren) {
				htmlStream.append("	treeFunct.add(" + id + ", " + dTreeRootId + ",'" + name + "', 'javascript:linkEmpty()', '', '', '" + imgFolder + "', '"
						+ imgFolderOp + "', '', 'menu" + requestIdentity + "(event, \\'" + createAddFunctionalityLink(id.toString()) + "\\', \\'"
						+ createDetailFunctionalityLink(id.toString()) + "\\', \\'\\', \\'\\', \\'" + createMoveUpMenuLink(menu) + "\\',\\'"
						+ createMoveDownMenuLink(menu) + "\\')');\n");
			} else {
				htmlStream.append("	treeFunct.add(" + id + ", " + dTreeRootId + ",'" + name + "', 'javascript:linkEmpty()', '', '', '" + imgFolder + "', '"
						+ imgFolderOp + "', '', 'menu" + requestIdentity + "(event, \\'" + createAddFunctionalityLink(id.toString()) + "\\', \\'"
						+ createDetailFunctionalityLink(id.toString()) + "\\', \\'" + createRemoveFunctionalityLink(id.toString()) + "\\', \\'"
						+ createMasterNodeMenuLink(menu) + "\\', \\'" + createMoveUpMenuLink(menu) + "\\',\\'" + createMoveDownMenuLink(menu) + "\\')');\n");
			}

		} else {

			if (hasChildren) {
				htmlStream.append("	treeFunct.add(" + id + ", " + parentId + ",'" + name + "', 'javascript:linkEmpty()', '', '', '" + imgFolder + "', '"
						+ imgFolderOp + "', '', 'menu" + requestIdentity + "(event, \\'" + createAddFunctionalityLink(id.toString()) + "\\', \\'"
						+ createDetailFunctionalityLink(id.toString()) + "\\', \\'\\', \\'" + createMasterNodeMenuLink(menu) + "\\',\\'"
						+ createMoveUpMenuLink(menu) + "\\',\\'" + createMoveDownMenuLink(menu) + "\\')');\n");
			}
			// else if(leaves.contains(id)){
			// htmlStream.append(" treeFunct.add(" + id + ", " + parentId + ",'" + name + "', 'javascript:linkEmpty()', '', '', '"+imgFolder+"',
			// '"+imgFolderOp+"', '', 'menu" + requestIdentity + "(event, \\'\\', \\'"+createDetailFunctionalityLink(id.toString())+"\\',
			// \\'"+createRemoveFunctionalityLink(id.toString())+"\\',
			// \\'"+createMasterNodeMenuLink(menu)+"\\',\\'"+createMoveUpMenuLink(menu)+"\\',\\'"+createMoveDownMenuLink(menu)+"\\')');\n");
			// }
			else {
				htmlStream.append("	treeFunct.add(" + id + ", " + parentId + ",'" + name + "', 'javascript:linkEmpty()', '', '', '" + imgFolder + "', '"
						+ imgFolderOp + "', '', 'menu" + requestIdentity + "(event, \\'" + createAddFunctionalityLink(id.toString()) + "\\', \\'"
						+ createDetailFunctionalityLink(id.toString()) + "\\', \\'" + createRemoveFunctionalityLink(id.toString()) + "\\', \\'"
						+ createMasterNodeMenuLink(menu) + "\\',\\'" + createMoveUpMenuLink(menu) + "\\',\\'" + createMoveDownMenuLink(menu) + "\\')');\n");

			}

		}
	}
 
Example 20
Source File: RhnTagFunctions.java    From spacewalk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Escape the characters in a String using JavaScript String rules.
 *
 * @param param to be escaped
 * @return escaped string
 */
public static String escapeJS(String param) {
    return StringEscapeUtils.escapeJavaScript(param);
}