public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n\n"); out.write("\n\n"); // Get required parameter(s) String nodeIdStr = request.getParameter("node"); if (nodeIdStr == null) throw new org.opennms.web.MissingParameterException("node"); int nodeId = Integer.parseInt(nodeIdStr); String nodeLabel = org.opennms.web.element.NetworkElementFactory.getNodeLabel(nodeId); Node node_db = NetworkElementFactory.getNode(nodeId); String orgName = node_db.getOrganizationName(); Asset asset = this.model.getAsset(nodeId); boolean isNew = false; if (asset == null) { asset = new Asset(); isNew = true; } Vector vCategories = WTProperties.getList("AssetCategories.list"); out.write("\n\n"); out.write("<html>\n"); out.write("<head>\n\t"); out.write("<title>WebTelemetry - Node Assets | System Info for "); out.print(node_db.getLabel()); out.write("</title>\n\t"); out.write("<base HREF=\""); out.print(org.opennms.web.Util.calculateUrlBase(request)); out.write("\" />\n\t"); out.write( "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\n\t"); out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">"); out.write("</script>\n"); out.write("</head>\n\n"); out.write("<body>\n\t"); out.write("<!-- Header -->\n\t"); String title = "Asset - Vendor Info for Node: " + node_db.getLabel() + " (" + orgName + ")"; out.write("\n\t"); JspRuntimeLibrary.include( request, response, "/includes/tabheader.jsp" + "?" + "title=" + java.net.URLEncoder.encode("" + title) + "&" + "refresh=" + "1" + "&" + "helpURL=" + "assetmanager%2FWTHelp_AssetManager.html" + "&" + "tabgroup=" + "asset" + "&" + "tabselected=" + "vendor" + "&" + "node=" + java.net.URLEncoder.encode("" + nodeIdStr), out, false); out.write("\n\n"); out.write("<!-- BEGIN FRAMING TABLE:open tags, keep at 100%-->\n"); out.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t"); out.write("<tr>\n\t\t"); out.write("<td width=\"10\">"); out.write( "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"10\" border=\"0\" alt=\"WebTelemetry\">"); out.write("</td>\n\t\t"); out.write("<td>\n\n"); out.write("<!-- USER-DEFINED ATTRIBUTES TABLE: was Identification -->\n "); out.write("<form action=\"asset/modifyAsset\" method=\"POST\" name=\"sysInfo\">\n "); out.write("<input type=\"hidden\" name=\"node\" value=\""); out.print(nodeId); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"isnew\" value=\""); out.print(isNew); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"view\" value=\"asset-tab-vendor\" />\n\n "); if (!isNew) { out.write("\n "); out.write("<!-- asset-tab-system -->\n "); out.write("<input type=\"hidden\" name=\"category\" value=\""); out.print(asset.getCategory()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"serialnumber\" value=\""); out.print(asset.getSerialNumber()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"manufacturer\" value=\""); out.print(asset.getManufacturer()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"operatingsystem\" value=\""); out.print(asset.getOperatingSystem()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"modelnumber\" value=\""); out.print(asset.getModelNumber()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"assetnumber\" value=\""); out.print(asset.getAssetNumber()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"dateinstalled\" value=\""); out.print(asset.getDateInstalled()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"description\" value=\""); out.print(asset.getDescription()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"comments\" value=\""); out.print(asset.getComments()); out.write("\" />\n\n "); out.write("<!-- asset-tab-location -->\n "); out.write("<input type=\"hidden\" name=\"region\" value=\""); out.print(asset.getRegion()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"division\" value=\""); out.print(asset.getDivision()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"department\" value=\""); out.print(asset.getDepartment()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"address1\" value=\""); out.print(asset.getAddress1()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"address2\" value=\""); out.print(asset.getAddress2()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"city\" value=\""); out.print(asset.getCity()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"state\" value=\""); out.print(asset.getState()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"zip\" value=\""); out.print(asset.getZip()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"building\" value=\""); out.print(asset.getBuilding()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"floor\" value=\""); out.print(asset.getFloor()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"room\" value=\""); out.print(asset.getRoom()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"rack\" value=\""); out.print(asset.getRack()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"slot\" value=\""); out.print(asset.getSlot()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"port\" value=\""); out.print(asset.getPort()); out.write("\" />\n "); out.write("<input type=\"hidden\" name=\"circuitid\" value=\""); out.print(asset.getCircuitId()); out.write("\" />\n "); } out.write("\n\n"); out.write("<!-- END FRAMING TABLE:open tags, keep at 100%-->\n\t"); out.write("<table width=\"98%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t "); out.write("<tr class=\"tableHeader\">\n\t "); out.write("<td colspan=\"6\" class=\"tableHeader\">Vendor"); out.write("</td>\n\t "); out.write("</tr>\n\t "); out.write("<tr class=\"tableRowLight\">\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Name:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"vendor\" value=\""); out.print(asset.getVendor()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Phone:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"vendorphone\" value=\""); out.print(asset.getVendorPhone()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Fax:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"vendorfax\" value=\""); out.print(asset.getVendorFax()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("</tr>\n\t "); out.write("<tr class=\"tableRowLight\">\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Lease:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"lease\" value=\""); out.print(asset.getLease()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Lease Expires:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"leaseexpires\" value=\""); out.print(asset.getLeaseExpires()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Vendor Asset:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"vendorassetnumber\" value=\""); out.print(asset.getVendorAssetNumber()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("</tr>\n\t "); out.write("<tr class=\"tableRowLight\">\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Maint Contract:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"maintcontract\" value=\""); out.print(asset.getMaintContract()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Contract Expires:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"maintcontractexpires\" value=\""); out.print(asset.getMaintContractExpires()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<span class=\"formText\">Maint Phone:"); out.write("</span>"); out.write("</td>\n\t "); out.write("<td class=\"tableText\">"); out.write("<input type=\"text\" name=\"supportphone\" value=\""); out.print(asset.getSupportPhone()); out.write("\" size=\"20\" maxlength=\"64\"/>"); out.write("</td>\n\t "); out.write("</tr>\n\t "); out.write("<tr class=\"tableRowLight\">\n\t "); out.write("<td class=\"tableText\" colspan=\"6\">"); out.write( "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"4\" width=\"10\" border=\"0\" alt=\"WebTelemetry\">"); out.write("</td>\n\t "); out.write("</tr>\n\t"); out.write("</table>"); out.write("<br />\n\n\t"); out.write("<table width=\"98%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n\t "); out.write("<tr>\n\t\t"); out.write("<td colspan=\"3\">"); out.write("<br />\n\t\t\t"); out.write("<INPUT type=\"hidden\" name=\"button\" value=\"\">\n\t\t\t"); out.write( "<INPUT type=\"image\" src=\"/wt-portal/images/buttons/btn_save_changes.gif\" onClick=\"document.sysInfo.button.value='Save Changes';\">\n\t\t\t \n\t\t\t"); out.write( "<a href=\"javascript:document.sysInfo.reset()\" onClick=\"javascript:document.sysInfo.reset();\">"); out.write("<img src=\"/wt-portal/images/buttons/btn_reset.gif\" border=\"0\" alt=\"Reset\">"); out.write("</a>"); out.write("<br /> \n\t\t\t"); out.write("<!-- "); out.write("<input type=\"submit\" value=\"Save Changes\"/>\n\t\t\t"); out.write("<input type=\"reset\" /> -->\n\t\t"); out.write("</td>\n\t\t"); out.write("<td colspan=\"3\" align=\"right\" class=\"message\">"); out.write("<br />\n\t\t\t"); if (isNew) { out.write("\n\t\t\t\tNew Record\n\t\t\t"); } else { out.write("\n\t\t\t\tLast Modified: "); out.print(WTTools.formatLocalDateToString(asset.getLastModifiedDate())); out.write(" by "); out.print(asset.getUserLastModified()); out.write("\n\t\t\t"); } out.write("\n\t\t"); out.write("</td>\n\t "); out.write("</tr>\n\t"); out.write("</table>\n\t"); out.write("</form>\n\n"); out.write("<!-- BEGIN FRAMING TABLE:close tags-->\n\t\t"); out.write("</td>\n\t"); out.write("</tr>\n"); out.write("</table>\n"); out.write("<!-- END FRAMING TABLE:close tags-->\n\n"); out.write("<br>\n"); JspRuntimeLibrary.include(request, response, "/includes/footer.jsp", out, false); out.write("\n\n"); out.write("</body>\n"); out.write("</html>\n"); } catch (Throwable t) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n\n"); // This JSP handles cross context communications from wt-monitor // to wt-core for use in accessing wt-core functionality that is // needed in WTnav-tree.jsp. // Assign a pooled DB connection handle Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(WTConstants.WATCHTOWERDB_CONN); int iIndex = 6100; GraphViewManager graphman = new GraphViewManager(ds); // Vector views = graphman.getViews(); Vector views = new Vector(); WTOrganization[] orgs = null; WTAccountCredentials ac = (WTAccountCredentials) request.getSession().getAttribute(WTAccountCredentials.SESSION_ATTRIBUTE_AC); if (ac != null) { // WTOrganization[] orgs = null; int selectedOrg = ac.getCurrentManagedId(); boolean siteUser = ac.getIsSiteUser(); int userId = ac.getUserId(); // Get list of organizations for the current user if (siteUser) { try { orgs = DAOImpl.OrgDAO.getWTOrganization(); } catch (Exception e) { e.printStackTrace(); } } else { if (!(userId < 0)) { try { orgs = DAOImpl.OrgDAO.getWTOrganizationsByUser(userId); } catch (Exception e) { e.printStackTrace(); } } } // Get the list of actively managed nodes if (selectedOrg == WTAccountCredentials.ALL_ORGS) { if (siteUser) { views = graphman.getViews(); } else { if (orgs != null) { int[] orgsIds = new int[orgs.length]; for (int i = 0; i < orgs.length; i++) { orgsIds[i] = orgs[i].getID(); } views = graphman.getViews(orgsIds); } } } else { views = graphman.getViews(selectedOrg); } } // My Graph Views is an experimental feature and is commented out until all kinks are worked // out. LS String strOutput = null; // if( views.size()==0 ) { // strOutput = "nav.add(6100, 6000, 'My Graph Views', '/wt-monitor/report/index.jsp', 'My // Customized Graph Views', 'mainContentsFrame', icon16_basedir + 'bs_chart.gif', // icon16_basedir + 'bs_chart.gif', '');\r\n"; // } else { // strOutput = "nav.add(6100, 6000, 'My Graph Views', '', 'My Customized Graph Views', // 'mainContentsFrame', icon16_basedir + 'bs_chart.gif', icon16_basedir + 'bs_chart.gif', // '');\r\n"; // } // for (int i=0; i<views.size(); i++) // { // iIndex++; // String strViewName = ((GraphViewJB)views.elementAt(i)).getName(); // int strOrgId = ((GraphViewJB)views.elementAt(i)).getOrgId(); // String orgName = null; // for(int j=0;j<orgs.length;j++){ // if(orgs[j].getID() != -1 && orgs[j].getID() == strOrgId){ // orgName = orgs[j].getName(); // } // } // // strOutput +="nav.add(" + iIndex + // ", 6100, '" + strViewName + // "', 'javascript: // PopupCenteredWindow(\\'/wt-core/jsp/sysmon/graphview/GraphView.jsp?view=" + strViewName + // "&orgname="+orgName +"&start=01&end=02" + "\\', \\'graphview\\', \\'yes\\', \\'yes\\', // \\'yes\\', \\'900\\', \\'1010\\'); location.href=\\'/wt-monitor/wt-jsp/WTnav-tree.jsp\\';', // 'Open " + strViewName + " Graph View', '', icon16_basedir + 'bs_chart.gif', icon16_basedir // + 'bs_chart.gif', '');\r\n"; // } out.write("\n\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n\n"); out.print(strOutput); out.write("\n"); } catch (Throwable t) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } }