private JSONObject makeJson() { response.setContentType("text/json"); JSONObject jsonObject = new JSONObject(); String attributes[] = new String[] { TEST.toString(), PropertySEARCH, PropertyEDIT, PropertyPROPERTIES, PropertyVERSIONS, PropertyREFACTOR, PropertyWHERE_USED, PropertyRECENT_CHANGES, SUITE.toString(), PropertyPRUNE, PropertySECURE_READ, PropertySECURE_WRITE, PropertySECURE_TEST, PropertyFILES }; for (String attribute : attributes) addJsonAttribute(jsonObject, attribute); if (pageData.hasAttribute(PropertyHELP)) { jsonObject.put(PropertyHELP, pageData.getAttribute(PropertyHELP)); } if (pageData.hasAttribute(PropertySUITES)) { JSONArray tags = new JSONArray(); for (String tag : pageData.getAttribute(PropertySUITES).split(",")) { if (StringUtils.isNotBlank(tag)) { tags.put(tag.trim()); } } jsonObject.put(PropertySUITES, tags); } return jsonObject; }
private String makeHtml(FitNesseContext context, Request request) { html = context.pageFactory.newPage(); html.setNavTemplate("viewNav"); html.put("viewLocation", request.getResource()); html.setTitle("Properties: " + resource); String tags = ""; if (pageData != null) { tags = pageData.getAttribute(PageData.PropertySUITES); } html.setPageTitle(new PageTitle("Page Properties", path, tags)); html.put("pageData", pageData); html.setMainTemplate("propertiesPage"); makeLastModifiedTag(); makeFormSections(); return html.html(); }
private void makeLastModifiedTag() { String username = pageData.getAttribute(LAST_MODIFYING_USER); if (username == null || "".equals(username)) html.put("lastModified", "Last modified anonymously"); else html.put("lastModified", "Last modified by " + username); }