diff options
Diffstat (limited to 'auth/auth-gui/src/main/java')
12 files changed, 89 insertions, 128 deletions
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java index 20a28cab..3223c53a 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java @@ -73,7 +73,7 @@ public class CUI extends HttpCode<AuthzTrans, Void> { aafcli= new AAFcli(gui.access,gui.env, pw, aafcon.hman(), aafcon.securityInfo(), - new HTransferSS(p,AAF_GUI.app, + new HTransferSS(p,AAF_GUI.APP, aafcon.securityInfo())); aafcli.verbose(false); aafcli.gui(true); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java index 5d243e9b..d55047a3 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java @@ -103,7 +103,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E public static final String AAF_GUI_COPYRIGHT = "aaf_gui_copyright"; public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST"; public static final int TIMEOUT = 60000; - public static final String app = "AAF GUI"; + public static final String APP = "AAF GUI"; // AAF API @@ -115,7 +115,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E public final AAFConHttp aafCon; public final AAFLurPerm lur; - public final Slot slot_httpServletRequest; + public final Slot slotHttpServletRequest; protected final String deployedVersion; private StaticSlot sThemeWebPath; private StaticSlot sDefaultTheme; @@ -132,12 +132,12 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E env.put(sThemeWebPath,"theme"); } - slot_httpServletRequest = env.slot(HTTP_SERVLET_REQUEST); + slotHttpServletRequest = env.slot(HTTP_SERVLET_REQUEST); deployedVersion = app_version; // Certificate Manager - String aaf_url_cm = env.getProperty(Config.AAF_URL_CM,Config.AAF_URL_CM_DEF); - cmCon = new AAFConHttp(env.access(),aaf_url_cm); + String aafUrlCm = env.getProperty(Config.AAF_URL_CM,Config.AAF_URL_CM_DEF); + cmCon = new AAFConHttp(env.access(),aafUrlCm); artifactsDF = env.newDataFactory(Artifacts.class); certInfoDF = env.newDataFactory(CertInfo.class); @@ -231,7 +231,6 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E // WebContent Handler /////////////////////// CachingFileAccess<AuthzTrans> cfa = new CachingFileAccess<AuthzTrans>(env); - //route(env,GET,"/"+env.get(sThemeWebPath)+"/:key*", cfa); route(env,GET,"/theme/:key*", cfa); /////////////////////// aafCon = aafCon(); @@ -254,7 +253,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E } public<RET> RET cmClientAsUser(TaggedPrincipal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException { - return cmCon.hman().best(new HTransferSS(p,app, aafCon.securityInfo()), retryable); + return cmCon.hman().best(new HTransferSS(p, APP, aafCon.securityInfo()), retryable); } @Override diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java index f056f4a7..125a5cab 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java @@ -52,9 +52,10 @@ public class BreadCrumbs extends NamedCode { cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, TransStore>() { @Override public void code(AAF_GUI gui, TransStore trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { - HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null); + HttpServletRequest req = trans.get(gui.slotHttpServletRequest, null); StringBuilder key = new StringBuilder(); - String value, hidden; + String value; + String hidden; for (Page p : breadcrumbs) { hidden=""; // Add keys for page from commandline, where possible. diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java index 3619e43d..36f18572 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java @@ -32,5 +32,5 @@ import org.onap.aaf.misc.xgen.html.HTMLGen; public interface ContentCode extends Code<HTMLGen> { public String[] idattrs(); public void addAttr(boolean first, String attr); - public boolean no_cache(); -} + public boolean noCache(); +}
\ No newline at end of file diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java index 3bec5405..270b13de 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java @@ -28,6 +28,7 @@ import org.onap.aaf.misc.xgen.Cache; import org.onap.aaf.misc.xgen.html.HTMLGen; public class Controls extends NamedCode { + public static final String INPUT = "input"; public Controls() { super(false,"controls"); } @@ -35,10 +36,10 @@ public class Controls extends NamedCode { @Override public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { hgen.incr("form","method=post") - .incr("input", true, "type=checkbox", "name=vehicle", "value=Bike").text("I have a bike").end() + .incr(INPUT, true, "type=checkbox", "name=vehicle", "value=Bike").text("I have a bike").end() .text("Password: ") - .incr("input", true, "type=password", "id=password1").end() - .tagOnly("input", "type=submit", "value=Submit") + .incr(INPUT, true, "type=password", "id=password1").end() + .tagOnly(INPUT, "type=submit", "value=Submit") .end(); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java index 74b5acc6..51909319 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java @@ -56,7 +56,7 @@ public class Display { new HttpCode<AuthzTrans,AAF_GUI>(gui,page.name()) { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { - trans.put(gui.slot_httpServletRequest, req); + trans.put(gui.slotHttpServletRequest, req); for (int i=0; i<fields.length;++i) { int idx = fields[i].indexOf("[]"); if (idx<0) { // single value @@ -89,13 +89,13 @@ public class Display { } else { // Transfer whether Page shouldn't be cached to local Final var. - final boolean no_cache = page.no_cache; + final boolean noCache = page.noCache; gui.route(gui.env, meth, page.url(), new HttpCode<AuthzTrans,AAF_GUI>(gui,page.name()) { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { - trans.put(gui.slot_httpServletRequest, req); + trans.put(gui.slotHttpServletRequest, req); for (int i=0; i<slots.length;++i) { int idx = fields[i].indexOf("[]"); if (idx<0) { // single value @@ -140,7 +140,7 @@ public class Display { @Override public boolean no_cache() { - return no_cache; + return noCache; } }, "text/html","*/*"); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java index caa58601..58771c01 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java @@ -31,8 +31,8 @@ public class Form extends NamedCode { private String preamble; private NamedCode content; - public Form(boolean no_cache, NamedCode content) { - super(no_cache,content); + public Form(boolean noCache, NamedCode content) { + super(noCache,content); this.content = content; preamble=null; } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java index 22069c55..7824601f 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java @@ -22,21 +22,21 @@ package org.onap.aaf.auth.gui; public abstract class NamedCode implements ContentCode { - private final boolean no_cache; + private final boolean noCache; private String name; private String[] idattrs; /* * Mark whether this code should not be cached, and any attributes */ - public NamedCode(final boolean no_cache, final String name) { + public NamedCode(final boolean noCache, final String name) { this.name = name; idattrs = new String[] {name}; - this.no_cache = no_cache; + this.noCache = noCache; } - public NamedCode(boolean no_cache, NamedCode content) { - this.no_cache = no_cache; + public NamedCode(boolean noCache, NamedCode content) { + this.noCache = noCache; name=content.name; idattrs = content.idattrs; } @@ -61,7 +61,7 @@ public abstract class NamedCode implements ContentCode { idattrs = temp; } - public boolean no_cache() { - return no_cache; + public boolean noCache() { + return noCache; } } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java index 1d797aad..b9ade574 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java @@ -78,20 +78,23 @@ public class Page extends HTMLCacheGen { public static final String AAF_URL_CADI_HELP = "aaf_url.cadi_help"; public static final String PERM_CA_TYPE = "certman"; public static final String PERM_NS = Define.ROOT_NS(); + public static final String HREF = "href="; + public static final String TARGET_BLANK = "target=_blank"; - public static enum BROWSER {iPhone,html5,ie,ieOld}; + public enum BROWSER {IPHONE, HTML5, IE, IEOLD}; public static final int MAX_LINE = 20; protected static final String[] NO_FIELDS = new String[0]; private static final String BROWSER_TYPE = "BROWSER_TYPE"; - private final String bcName, bcUrl; + private final String bcName; + private final String bcUrl; private final String[] fields; - public final boolean no_cache; + public final boolean noCache; // Note: Only access is synchronized in "getPerm" - private final static Map<String,Map<String,Permission>> perms = new HashMap<>(); + private static final Map<String,Map<String,Permission>> perms = new HashMap<>(); /* * Relative path, Menu Name, Full Path @@ -102,8 +105,8 @@ public class Page extends HTMLCacheGen { {"ns","My Namespaces","/gui/ns"}, {"approve","My Approvals","/gui/approve"}, {"myrequests","My Pending Requests","/gui/myrequests"}, - // Enable later - // {"onboard","Onboarding"}, + // Enable later + //{"onboard","Onboarding"}, {"passwd","Password Management","/gui/passwd"}, {"cui","Command Prompt","/gui/cui"}, {"api","AAF API","/gui/api"}, @@ -133,14 +136,14 @@ public class Page extends HTMLCacheGen { bcName = name; bcUrl = url; // Mark which fields must be "no_cache" - boolean no_cacheTemp=false; + boolean noCacheTemp=false; for (NamedCode nc : content) { - if (nc.no_cache()) { - no_cacheTemp=true; + if (nc.noCache()) { + noCacheTemp=true; break; } } - no_cache=no_cacheTemp; + noCache =noCacheTemp; } public Page(AuthzEnv env, String name, String url, String [] fields, final NamedCode ... content) throws APIException,IOException { this(env,name,url,1,fields,content); @@ -156,14 +159,14 @@ public class Page extends HTMLCacheGen { bcName = name; bcUrl = url; // Mark which fields must be "no_cache" - boolean no_cacheTemp=false; + boolean noCacheTemp=false; for (NamedCode nc : content) { - if (nc.no_cache()) { - no_cacheTemp=true; + if (nc.noCache()) { + noCacheTemp=true; break; } } - no_cache=no_cacheTemp; + noCache =noCacheTemp; } @@ -243,11 +246,11 @@ public class Page extends HTMLCacheGen { imp.js(prefix + f); } else if(f.endsWith(".css")) { if(f.endsWith("iPhone.css")) { - if(BROWSER.iPhone.equals(browser)) { + if(BROWSER.IPHONE.equals(browser)) { imp.css(prefix + f); } } else if (f.endsWith("Desktop.css")){ - if(!BROWSER.iPhone.equals(browser)) { + if(!BROWSER.IPHONE.equals(browser)) { imp.css(prefix + f); } // Make Console specific to Console page @@ -267,8 +270,8 @@ public class Page extends HTMLCacheGen { @Override public void code(AAF_GUI state, AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { switch(browser(trans,browserSlot)) { - case ieOld: - case ie: + case IEOLD: + case IE: hgen.directive("!DOCTYPE html"); hgen.directive("meta", "http-equiv=X-UA-Compatible","content=IE=11"); default: @@ -321,8 +324,8 @@ public class Page extends HTMLCacheGen { hgen.imports(getImports(env,theme,backdots,browser)); switch(browser) { - case ie: - case ieOld: + case IE: + case IEOLD: hgen.js().text("document.createElement('header');") .text("document.createElement('nav');") .done(); @@ -348,7 +351,8 @@ public class Page extends HTMLCacheGen { // Obtain User Info, and print TaggedPrincipal p = trans.getUserPrincipal(); - String user,secured; + String user; + String secured; if (p==null) { user = "please choose a Login Authority"; secured = "NOT Secure!"; @@ -363,8 +367,8 @@ public class Page extends HTMLCacheGen { .text("</sup>").end(); switch(browser(trans,browserSlot)) { - case ieOld: - case ie: + case IEOLD: + case IE: xgen.incr("h5").text("This app is Mobile First HTML5. Internet Explorer " + " does not support all HTML5 standards. Old, non TSS-Standard versions may not function correctly.").br() .text(" For best results, use a highly compliant HTML5 browser like Firefox.") @@ -435,12 +439,10 @@ public class Page extends HTMLCacheGen { props = themeProps==null?null:themeProps.get(theme); } - if(props!=null) { - if("TRUE".equalsIgnoreCase(props.getProperty("main_menu_in_nav"))) { + if((props!=null) && ("TRUE".equalsIgnoreCase(props.getProperty("main_menu_in_nav")))) { xgen.incr("h2").text("Navigation").end(); Mark mark = new Mark(); boolean selected = isSelected(trans.path(),Home.HREF); - //trans.path().endsWith("home"); xgen.incr(mark,HTMLGen.UL) .incr(HTMLGen.LI,selected?"class=selected":"") .incr(HTMLGen.A, "href=home") @@ -448,7 +450,6 @@ public class Page extends HTMLCacheGen { .end(2); boolean noSelection = !selected; for(String[] mi : MENU_ITEMS) { - //selected = trans.path().endsWith(mi[0]); if(noSelection) { selected = isSelected(trans.path(),mi[2]); noSelection = !selected; @@ -456,12 +457,11 @@ public class Page extends HTMLCacheGen { selected = false; } xgen.incr(HTMLGen.LI,selected?"class=selected":"") - .incr(HTMLGen.A, "href="+mi[2]) + .incr(HTMLGen.A, HREF+mi[2]) .text(mi[1]) .end(2); } xgen.end(mark); - } } } @@ -488,21 +488,21 @@ public class Page extends HTMLCacheGen { }); hgen.incr("h2").text("Related Links").end(); hgen.incr(UL); - String aaf_help = env.getProperty(AAF_URL_AAF_HELP,null); - if (aaf_help!=null) { - hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_AAF_HELP),"target=_blank").text("AAF WIKI").end(2); + String aafHelp = env.getProperty(AAF_URL_AAF_HELP,null); + if (aafHelp!=null) { + hgen.leaf(LI).leaf(A,HREF+env.getProperty(AAF_URL_AAF_HELP),TARGET_BLANK).text("AAF WIKI").end(2); String sub = env.getProperty(AAF_URL_AAF_HELP+".sub"); if (sub!=null) { hgen.incr(UL,"style=margin-left:5%"); for (String s : Split.splitTrim(',', sub)) { - hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_AAF_HELP+".sub."+s),"target=_blank").text(s.replace('+', ' ')).end(2); + hgen.leaf(LI).leaf(A,HREF+env.getProperty(AAF_URL_AAF_HELP+".sub."+s),TARGET_BLANK).text(s.replace('+', ' ')).end(2); } hgen.end(); } } - aaf_help = env.getProperty(AAF_URL_CADI_HELP,null); - if (aaf_help!=null) { - hgen.leaf(LI).leaf(A,"href="+aaf_help,"target=_blank").text("CADI WIKI").end(2); + aafHelp = env.getProperty(AAF_URL_CADI_HELP,null); + if (aafHelp!=null) { + hgen.leaf(LI).leaf(A,HREF+aafHelp,TARGET_BLANK).text("CADI WIKI").end(2); } String tools = env.getProperty(AAFURL_TOOLS); if (tools!=null) { @@ -511,7 +511,7 @@ public class Page extends HTMLCacheGen { .leaf(HTMLGen.H3).text("Related Tools").end(); for (String tool : Split.splitTrim(',',tools)) { - hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_TOOL_DOT+tool),"target=_blank").text(tool.replace('+', ' ')).end(2); + hgen.leaf(LI).leaf(A,HREF+env.getProperty(AAF_URL_TOOL_DOT+tool),TARGET_BLANK).text(tool.replace('+', ' ')).end(2); } hgen.end(); } @@ -563,19 +563,19 @@ public class Page extends HTMLCacheGen { String agent = trans.agent(); int msie; if (agent.contains("iPhone") /* other phones? */) { - br=BROWSER.iPhone; + br=BROWSER.IPHONE; } else if ((msie = agent.indexOf("MSIE"))>=0) { msie+=5; - int end = agent.indexOf(";",msie); + int end = agent.indexOf(';',msie); float ver; try { ver = Float.valueOf(agent.substring(msie,end)); - br = ver<8f?BROWSER.ieOld:BROWSER.ie; + br = ver<8f?BROWSER.IEOLD :BROWSER.IE; } catch (Exception e) { - br = BROWSER.ie; + br = BROWSER.IE; } } else { - br = BROWSER.html5; + br = BROWSER.HTML5; } trans.put(slot,br); } @@ -603,7 +603,7 @@ public class Page extends HTMLCacheGen { } protected static String getSingleParam(HttpServletRequest req, String tag) { - String values[] = req.getParameterValues(tag); + String[] values = req.getParameterValues(tag); return values.length<1?null:values[0]; } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java index aa10289c..389bc903 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java @@ -55,7 +55,7 @@ public class LoginLanding extends Page { cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() { @Override public void code(AAF_GUI authGUI, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen) throws APIException, IOException { - HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null); + HttpServletRequest req = trans.get(gui.slotHttpServletRequest, null); if (req!=null) { String query = req.getQueryString(); if (query!=null) { @@ -68,47 +68,7 @@ public class LoginLanding extends Page { xgen.leaf(HTMLGen.A, "href=gui/home?Authentication=BasicAuth").text("AAF Basic Auth").end(); } }); -// hgen.leaf("a", "href=#","onclick=divVisibility('cso');").text("Global Login").end() -// .incr("p", "id=cso","style=display:none").text("this will redirect to global login").end() -// .leaf("a", "href=#","onclick=divVisibility('tguard');").text("tGuard").end() -// .incr("p", "id=tguard","style=display:none").text("this will redirect to tGuard login").end() -// hgen.leaf("a", "href=#","onclick=divVisibility('basicauth');").text("AAF Basic Auth").end(); hgen.end(loginPaths); - -// hgen.incr("form","method=post","style=display:none","id=basicauth","gui/home?Authentication=BasicAuth"); -// Mark table = new Mark(TABLE); -// hgen.incr(table); -// cache.dynamic(hgen, new DynamicCode<HTMLGen, AuthGUI, AuthzTrans>() { -// @Override -// public void code(final AuthGUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) -// throws APIException, IOException { -// hgen -// .input(fields[0],"Username",true) -// .input(fields[1],"Password",true, "type=password"); -// Mark selectRow = new Mark(); -// hgen -// .incr(selectRow, "tr") -// .incr("td") -// .incr("label", "for=envs", "required").text("Environment").end() -// .end() -// .incr("td") -// .incr("select", "name=envs", "id=envs", "required") -// .incr("option", "value=").text("Select Environment").end(); -// for (String env : envs) { -// hgen.incr("option", "value="+env).text(env).end(); -// } -// hgen -// .end(selectRow) - -// hgen.end(); -// } -// }); -// hgen.end(); -// hgen.tagOnly("input", "type=submit", "value=Submit") -// .tagOnly("input", "type=reset", "value=Reset") -// .end(); - - } }); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java index b6a6a016..8ff11e13 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java @@ -103,7 +103,7 @@ public class RequestDetail extends Page { } else { if (!(trans.user().equals(app.getUser()) || trans.user().equals(app.getApprover()))) { - HttpServletRequest req = trans.get(gui.slot_httpServletRequest,null); + HttpServletRequest req = trans.get(gui.slotHttpServletRequest,null); if(req==null || !req.isUserInRole(Define.ROOT_NS()+"|access|*|*")) { return Cells.EMPTY; } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java index 3c30e807..0e60825f 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java @@ -38,6 +38,8 @@ import org.onap.aaf.misc.xgen.html.HTMLGen; public class WebCommand extends Page { public static final String HREF = "/gui/cui"; + public static final String INPUT = "input"; + public static final String TYPE_BUTTON = "type=button"; public WebCommand(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException { super(gui.env, "Web Command Client",HREF, NO_FIELDS, @@ -64,47 +66,45 @@ public class WebCommand extends Page { @Override public void code(AAF_GUI state, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen) throws APIException, IOException { - String image_root = "src=../../"+state.env.get(sThemeWebPath).toString() + '/' + state.env.get(sTheme) + "/images/icons"; - hgen.img(image_root + "/options_down.png", "onclick=handleDivHiding('options',this);", + String imageRoot = "src=../../"+state.env.get(sThemeWebPath).toString() + '/' + state.env.get(sTheme) + "/images/icons"; + hgen.img(imageRoot + "/options_down.png", "onclick=handleDivHiding('options',this);", "id=options_img", "alt=Options", "title=Options") .end(); //options_link hgen.divID("options"); switch(browser(trans,trans.env().slot(getBrowserType()))) { - case ie: - case ieOld: + case IE: + case IEOLD: // IE doesn't support file save break; default: - xgen.img(image_root+"/AAF_download.png", "onclick=saveToFile();", + xgen.img(imageRoot+"/AAF_download.png", "onclick=saveToFile();", "alt=Save log to file", "title=Save log to file"); } -// xgen.img("src=../../"+gui.theme+"/AAF_email.png", "onclick=emailLog();", -// "alt=Email log to me", "title=Email log to me"); - xgen.img(image_root+"/AAF_font_size.png", "onclick=handleDivHiding('text_slider',this);", + xgen.img(imageRoot+"/AAF_font_size.png", "onclick=handleDivHiding('text_slider',this);", "id=fontsize_img", "alt=Change text size", "title=Change text size"); - xgen.img(image_root+"/AAF_details.png", "onclick=selectOption(this,0);", + xgen.img(imageRoot+"/AAF_details.png", "onclick=selectOption(this,0);", "id=details_img", "alt=Turn on/off details mode", "title=Turn on/off details mode"); - xgen.img(image_root+"/AAF_maximize.png", "onclick=maximizeConsole(this);", + xgen.img(imageRoot+"/AAF_maximize.png", "onclick=maximizeConsole(this);", "id=maximize_img", "alt=Maximize Console Window", "title=Maximize Console Window"); } }); hgen.divID("text_slider"); - hgen.tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('dec')", "value=-") - .tagOnly("input", "id=text_size_slider", "type=range", "min=75", "max=200", "value=100", + hgen.tagOnly(INPUT, TYPE_BUTTON, "class=change_font", "onclick=buttonChangeFontSize('dec')", "value=-") + .tagOnly(INPUT, "id=text_size_slider", "type=range", "min=75", "max=200", "value=100", "oninput=changeFontSize(this.value)", "onchange=changeFontSize(this.value)", "title=Change Text Size") - .tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('inc')", "value=+") + .tagOnly(INPUT, TYPE_BUTTON, "class=change_font", "onclick=buttonChangeFontSize('inc')", "value=+") .end(); //text_slider hgen.end(); //options hgen.end(); //console_and_options hgen.divID("input_area"); - hgen.tagOnly("input", "type=text", "id=command_field", + hgen.tagOnly(INPUT, "type=text", "id=command_field", "autocomplete=off", "autocorrect=off", "autocapitalize=off", "spellcheck=false", "onkeypress=keyPressed()", "placeholder=Type your AAFCLI commands here", "autofocus") - .tagOnly("input", "id=submit", "type=button", "value=Submit", + .tagOnly(INPUT, "id=submit", TYPE_BUTTON, "value=Submit", "onclick=http('put','../../gui/cui',getCommand(),callCUI);") .end(); |