From tkasparek at fedoraproject.org Thu Aug 20 12:18:12 2015 Content-Type: multipart/mixed; boundary="===============5174279233531520891==" MIME-Version: 1.0 From: =?utf-8?q?Tom=C3=A1=C5=A1_Ka=C5=A1p=C3=A1rek_=3Ctkasparek_at_fedoraprojec?= =?utf-8?q?t=2Eorg=3E?= To: spacewalk-commits at lists.fedorahosted.org Subject: java/code Date: Tue, 17 Dec 2013 15:54:25 +0000 Message-ID: <20131217155425.A69A360F4D@fedorahosted.org> --===============5174279233531520891== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable java/code/src/com/redhat/rhn/frontend/configuration/tags/ConfigSystemTag.j= ava | 149 ---------- java/code/src/com/redhat/rhn/frontend/configuration/tags/test/ConfigSystem= TagTest.java | 114 ------- java/code/src/com/redhat/rhn/frontend/taglibs/rhn-config-management.tld = | 36 -- java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/deploy= global.jspf | 3 = java/code/webapp/WEB-INF/pages/configuration/files/comparedeployed.jsp = | 2 = java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp = | 13 = 6 files changed, 9 insertions(+), 308 deletions(-) New commits: commit 5f63b61621012d1b09a53597abcec92190eb597f Author: Tomas Kasparek Date: Tue Dec 17 15:52:49 2013 +0100 delete ConfigSystemTag as these things are easily handled in jsp diff --git a/java/code/src/com/redhat/rhn/frontend/configuration/tags/Confi= gSystemTag.java b/java/code/src/com/redhat/rhn/frontend/configuration/tags/= ConfigSystemTag.java deleted file mode 100644 index f0759ee..0000000 --- a/java/code/src/com/redhat/rhn/frontend/configuration/tags/ConfigSystem= Tag.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright (c) 2009--2010 Red Hat, Inc. - * - * This software is licensed to you under the GNU General Public License, - * version 2 (GPLv2). There is NO WARRANTY for this software, express or - * implied, including the implied warranties of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 - * along with this software; if not, see - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * Red Hat trademarks are not licensed under GPLv2. No permission is - * granted to use or replicate Red Hat trademarks that are incorporated - * in this software or its documentation. - */ -package com.redhat.rhn.frontend.configuration.tags; - -import org.apache.commons.lang.StringEscapeUtils; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.BodyTagSupport; -import javax.servlet.jsp.tagext.TagSupport; - -/** - * ConfigSystemTag - * @version $Rev$ - */ -public class ConfigSystemTag extends TagSupport { - - /** - * Comment for serialVersionUID - */ - private static final long serialVersionUID =3D 1582063245840138731L; - - public static final String SYSTEM_ALT_KEY =3D "system.common.systemAlt= "; - public static final String SYSTEM_LIST_ICON =3D "/img/rhn-listicon-sys= tem.gif"; - public static final String SYSTEM_HEADER_ICON =3D "/img/rhn-icon-syste= m.gif"; - public static final String SYSTEM_URL =3D - "/rhn/systems/details/configuration/Overview.do"; - - /** - * - */ - private String id; - private String name; - private boolean nolink; - - /** - * {@inheritDoc} - */ - public int doEndTag() throws JspException { - if (nolink || id =3D=3D null) { - writeIcon(); - ConfigTagHelper.write(StringEscapeUtils.escapeXml(name), page= Context); - } - else { - String url =3D makeConfigSystemUrl(id); - ConfigTagHelper.write("", pageConte= xt); - writeIcon(); - ConfigTagHelper.write(StringEscapeUtils.escapeXml(name) + "", pageContext); - } - return BodyTagSupport.SKIP_BODY; - } - - /** - * {@inheritDoc} - */ - public void release() { - id =3D null; - name =3D null; - nolink =3D false; - super.release(); - } - - - /** - * @param val the id to set - */ - public void setId(String val) { - this.id =3D val; - } - - - /** - * @param isNoLink the nolink to set - */ - public void setNolink(String isNoLink) { - this.nolink =3D Boolean.TRUE.toString().equalsIgnoreCase(isNoLink= ); - } - - - /** - * @param value the name to set - */ - public void setName(String value) { - this.name =3D value; - } - - private void writeIcon() throws JspException { - ConfigTagHelper.writeIcon(SYSTEM_LIST_ICON, SYSTEM_ALT_KEY, pageCo= ntext); - } - - /** - * Returns the URL to reach the SDC\ConfigOverview page for a system. - * This method may also be used with the el expression - * ${config:systemUrl('id')} - * This method is public static because - * EL functions defined in a TLD file, - * need to be public static methods.. systemConfig file - * @param id the SID of the system in question - * @return the URL to reach the cfg-overview page in the SDC - */ - public static String makeConfigSystemUrl(String id) { - return SYSTEM_URL + "?sid=3D" + id; - } - - /** - * Returns the Header icon image path for a system - * This method is public static because - * EL functions defined in a TLD file, - * need to be public static methods.. - * @return the image path - */ - public static final String getHeaderIconFor() { - return SYSTEM_HEADER_ICON; - } - - /** - * Returns the List icon image path for a system - * This method is public static because - * EL functions defined in a TLD file, - * need to be public static methods.. - * @return the image path - */ - public static final String getListIconFor() { - return SYSTEM_LIST_ICON; - } - - - /** - * Returns the Header alt key for a system - * This method is public static because - * EL functions defined in a TLD file, - * need to be public static methods.. - * @return the alt key - */ - public static final String getAltKeyFor() { - return SYSTEM_ALT_KEY; - } -} diff --git a/java/code/src/com/redhat/rhn/frontend/configuration/tags/test/= ConfigSystemTagTest.java b/java/code/src/com/redhat/rhn/frontend/configurat= ion/tags/test/ConfigSystemTagTest.java deleted file mode 100644 index 9833931..0000000 --- a/java/code/src/com/redhat/rhn/frontend/configuration/tags/test/ConfigS= ystemTagTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Copyright (c) 2009--2010 Red Hat, Inc. - * - * This software is licensed to you under the GNU General Public License, - * version 2 (GPLv2). There is NO WARRANTY for this software, express or - * implied, including the implied warranties of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 - * along with this software; if not, see - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * Red Hat trademarks are not licensed under GPLv2. No permission is - * granted to use or replicate Red Hat trademarks that are incorporated - * in this software or its documentation. - */ -package com.redhat.rhn.frontend.configuration.tags.test; - -import com.redhat.rhn.common.localization.LocalizationService; -import com.redhat.rhn.frontend.configuration.tags.ConfigSystemTag; -import com.redhat.rhn.testing.RhnBaseTestCase; -import com.redhat.rhn.testing.RhnMockHttpServletRequest; -import com.redhat.rhn.testing.RhnMockJspWriter; -import com.redhat.rhn.testing.TagTestUtils; - -import com.mockobjects.helpers.TagTestHelper; - -import java.net.URL; - -import javax.servlet.jsp.tagext.Tag; - -/** - * ConfigSystemTagTest - * @version $Rev$ - */ -public class ConfigSystemTagTest extends RhnBaseTestCase { - /** - * Called once per test method. - * @throws Exception if an error occurs during setup. - */ - protected void setUp() throws Exception { - super.setUp(); - ConfigSystemTag tag =3D new ConfigSystemTag(); - RhnMockHttpServletRequest request =3D new RhnMockHttpServletReques= t(); - TagTestHelper tth =3D TagTestUtils.setupTagTest(tag, - new URL("http://localhost"), - request); - tag.setPageContext(tth.getPageContext()); - } - - /** Test tag output for files - */ - public void testSystem() throws Exception { - - String alt =3D ConfigSystemTag.SYSTEM_ALT_KEY; - String imgName =3D ConfigSystemTag.SYSTEM_LIST_ICON; - - execTest(0, "bar", false, alt, imgName); - } - - public void execTest(int id, String name, boolean nolink, - String altKey, String imgName) throws Exception { - ConfigSystemTag tag =3D new ConfigSystemTag(); - RhnMockHttpServletRequest request =3D new RhnMockHttpServletReques= t(); - TagTestHelper tth =3D TagTestUtils.setupTagTest(tag, - new URL("http://localhost"), - request); - tag.setPageContext(tth.getPageContext()); - if (id >=3D 0) { - tag.setId(String.valueOf(id)); - } - - tag.setName(name); - tag.setNolink(String.valueOf(nolink)); - - // ok let's test the tag - tth.assertDoStartTag(Tag.SKIP_BODY); - tth.assertDoEndTag(Tag.SKIP_BODY); - - RhnMockJspWriter rout =3D (RhnMockJspWriter) tth.getPageContext().= getOut(); - - assertTrue(rout.toString().indexOf(name) > -1); - assertFalse(rout.toString().indexOf("alt =3D\"\"") > -1); - LocalizationService service =3D LocalizationService.getInstance(); - String alt =3D service.getMessage(altKey); - assertTrue(rout.toString().indexOf(alt) > -1); - assertTrue(rout.toString().indexOf(imgName) > -1); - if (!nolink && id >=3D 0) { - String url =3D " -1); - assertTrue(url.startsWith(ConfigSystemTag.SYSTEM_URL)); - } - - private void checkFunctions(String icon, String altKey, String type) { - assertEquals(altKey, ConfigSystemTag.getAltKeyFor()); - assertEquals(icon, ConfigSystemTag.getHeaderIconFor()); - } -} diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/rhn-config-manag= ement.tld b/java/code/src/com/redhat/rhn/frontend/taglibs/rhn-config-manage= ment.tld index e291ddf..7522689 100644 --- a/java/code/src/com/redhat/rhn/frontend/taglibs/rhn-config-management.t= ld +++ b/java/code/src/com/redhat/rhn/frontend/taglibs/rhn-config-management.t= ld @@ -63,26 +63,6 @@ true - - system - com.redhat.rhn.frontend.configuration.tags.ConfigSystem= Tag - empty - - id - false - true - - - name - true - true - - - nolink - false - true - - = channelUrl @@ -138,21 +118,5 @@ fileAlt com.redhat.rhn.frontend.configuration.tags.ConfigFileT= ag java.lang.String getAltKeyFor(java.lang.String) - = - = - - systemHeaderIcon - com.redhat.rhn.frontend.configuration.tags.ConfigSyste= mTag - java.lang.String getHeaderIconFor() - - systemListIcon - com.redhat.rhn.frontend.configuration.tags.ConfigSyste= mTag - java.lang.String getListIconFor() - = - - systemAlt - com.redhat.rhn.frontend.configuration.tags.ConfigSyste= mTag - java.lang.String getAltKeyFor() - = diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/= files/deployglobal.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/c= onfiguration/files/deployglobal.jspf index 55ca49f..718f538 100644 --- a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/d= eployglobal.jspf +++ b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/d= eployglobal.jspf @@ -3,6 +3,7 @@ <%@ taglib uri=3D"http://struts.apache.org/tags-bean" prefix=3D"bean" %> <%@ taglib uri=3D"http://struts.apache.org/tags-html" prefix=3D"html" %> <%@ taglib uri=3D"http://rhn.redhat.com/tags/config-managment" prefix=3D"c= fg" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/functions" prefix=3D"fn" %> = - * + ${fn:escapeXml(curren= t.name)} * = diff --git a/java/code/webapp/WEB-INF/pages/configuration/files/comparedepl= oyed.jsp b/java/code/webapp/WEB-INF/pages/configuration/files/comparedeploy= ed.jsp index d76fe77..b44bb85 100644 --- a/java/code/webapp/WEB-INF/pages/configuration/files/comparedeployed.jsp +++ b/java/code/webapp/WEB-INF/pages/configuration/files/comparedeployed.jsp @@ -29,7 +29,7 @@ = - + ${fn:escapeXml(current.name)= } = diff --git a/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresul= t.jsp b/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp index 4af2a56..bb2e818 100644 --- a/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp +++ b/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp @@ -4,14 +4,16 @@ <%@ taglib uri=3D"http://java.sun.com/jsp/jstl/core" prefix=3D"c" %> <%@ taglib uri=3D"http://java.sun.com/jsp/jstl/fmt" prefix=3D"fmt" %> <%@ taglib uri=3D"http://struts.apache.org/tags-bean" prefix=3D"bean" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/functions" prefix=3D"fn" %> <%@ include file=3D"/WEB-INF/pages/common/fragments/systems/system-header.= jspf" %> -

-

+ + +

= = - += ${fn:escapeXml(current.name)} = = @@ -79,4 +78,4 @@

- \ No newline at end of file + --===============5174279233531520891==--