1 /*******************************************************************************
2 * Copyright (c) 2016 AT&T Intellectual Property. All rights reserved.
3 *******************************************************************************/
4 package com.att.authz.gui.pages;
6 import java.io.IOException;
8 import com.att.authz.env.AuthzTrans;
9 import com.att.authz.gui.AuthGUI;
10 import com.att.authz.gui.BreadCrumbs;
11 import com.att.authz.gui.NamedCode;
12 import com.att.authz.gui.Page;
13 import com.att.inno.env.APIException;
14 import com.att.xgen.Cache;
15 import com.att.xgen.DynamicCode;
16 import com.att.xgen.Mark;
17 import com.att.xgen.html.HTMLGen;
19 public class WebCommand extends Page {
20 public static final String HREF = "/gui/cui";
22 public WebCommand(final AuthGUI gui, final Page ... breadcrumbs) throws APIException, IOException {
23 super(gui.env, "Web Command Client",HREF, NO_FIELDS,
24 new BreadCrumbs(breadcrumbs),
25 new NamedCode(true, "content") {
27 public void code(Cache<HTMLGen> cache, HTMLGen hgen) throws APIException, IOException {
28 hgen.leaf("p","id=help_msg")
29 .text("Questions about this page? ")
30 .leaf("a", "href=http://wiki.web.att.com/display/aaf/Web+CUI+Usage", "target=_blank")
33 .text(". Type 'help' below for a list of AAF commands")
36 .divID("console_and_options");
37 hgen.divID("console_area");
38 hgen.end(); //console_area
40 hgen.divID("options_link", "class=closed");
41 hgen.img("src=../../theme/options_down.png", "onclick=handleDivHiding('options',this);",
42 "id=options_img", "alt=Options", "title=Options")
43 .end(); //options_link
45 hgen.divID("options");
46 cache.dynamic(hgen, new DynamicCode<HTMLGen,AuthGUI,AuthzTrans>() {
48 public void code(AuthGUI state, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen)
49 throws APIException, IOException {
50 switch(browser(trans,trans.env().slot(getBrowserType()))) {
53 // IE doesn't support file save
56 xgen.img("src=../../theme/AAFdownload.png", "onclick=saveToFile();",
57 "alt=Save log to file", "title=Save log to file");
59 // xgen.img("src=../../theme/AAFemail.png", "onclick=emailLog();",
60 // "alt=Email log to me", "title=Email log to me");
61 xgen.img("src=../../theme/AAF_font_size.png", "onclick=handleDivHiding('text_slider',this);",
62 "id=fontsize_img", "alt=Change text size", "title=Change text size");
63 xgen.img("src=../../theme/AAF_details.png", "onclick=selectOption(this,0);",
64 "id=details_img", "alt=Turn on/off details mode", "title=Turn on/off details mode");
65 xgen.img("src=../../theme/AAF_maximize.png", "onclick=maximizeConsole(this);",
66 "id=maximize_img", "alt=Maximize Console Window", "title=Maximize Console Window");
70 hgen.divID("text_slider");
71 hgen.tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('dec')", "value=-")
72 .tagOnly("input", "id=text_size_slider", "type=range", "min=75", "max=200", "value=100",
73 "oninput=changeFontSize(this.value)", "onchange=changeFontSize(this.value)", "title=Change Text Size")
74 .tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('inc')", "value=+")
78 hgen.end(); //console_and_options
80 hgen.divID("input_area");
81 hgen.tagOnly("input", "type=text", "id=command_field",
82 "autocomplete=off", "autocorrect=off", "autocapitalize=off", "spellcheck=false",
83 "onkeypress=keyPressed()", "placeholder=Type your AAFCLI commands here", "autofocus")
84 .tagOnly("input", "id=submit", "type=button", "value=Submit",
85 "onclick=http('put','../../gui/cui',getCommand(),callCUI);")
88 Mark callCUI = new Mark();
90 hgen.text("function callCUI(resp) {")
91 .text("moveCommandToDiv();")
92 .text("printResponse(resp);")