|
From: Michael K. <ko...@us...> - 2006-06-27 10:13:17
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/category In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13405 Modified Files: Category.java CategoryManagerImpl.java CategoryPresenter.java CategoryServlet.java Log Message: Index: CategoryPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/CategoryPresenter.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- CategoryPresenter.java 27 Jun 2006 09:27:38 -0000 1.18 +++ CategoryPresenter.java 27 Jun 2006 10:13:12 -0000 1.19 @@ -420,7 +420,8 @@ * @return The html form input field as String */ public final String printAttrInput(String categoryClass, String aname, - String lang, String requestVal, int rows, int cols, + String lang, String requestVal, + int rows, int cols, boolean readonly) { String result = ""; @@ -444,15 +445,12 @@ } typeName = odat.getTypeName(); - logger.debug("attributeName: "+attr); - logger.debug("typeName: "+typeName); if (odat.hasMaxLength()) { maxLength = odat.getMaxLength(); } } if (rows == -1) { - logger.debug("rows == -1"); for (int i = 0; i < LONG_DATATYPES.length; i++) { if (typeName.equals(LONG_DATATYPES[i])) { rows = ROWS_FOR_LONG_INPUT; @@ -468,11 +466,9 @@ if (attr.equalsIgnoreCase("title")) { rows = 1; } - logger.debug("rows = "+rows); } if ((oca != null) && !oca.getValues().isEmpty()) { - logger.debug("in dropDown if"); //There are possible values if (requestVal != null) { result += printDropDown(categoryClass, aname, requestVal, lang, @@ -481,7 +477,6 @@ result += printDropDown(categoryClass, aname, defaultVal, lang, "attribute", false, readonly); } - } else if(typeName.equals("category")){ logger.debug("in category if"); Map attrs = new HashMap(); @@ -492,14 +487,19 @@ // show the categories as options for(int i=0; i<ret.size();i++){ result += "<option value=\""+((Category)(ret.get(i))).getId(); - + Object o = ret.get(i); + String tmps = ""; + if (o instanceof Category) { + tmps = Integer.toString(((Category)o).getId()); + } else { + tmps = o.toString(); + } if(requestVal != null && - requestVal.trim().equals( (new Integer(((Category)(ret.get(i))). - getId())).toString().trim())) + requestVal.trim().equals(tmps)) { result += "\" selected>"+((Category)(ret.get(i))).getTitle(); - else + } else { result += "\">"+((Category)(ret.get(i))).getTitle(); - + } result += "</option>\n"; } result += "</select>"; @@ -599,59 +599,28 @@ result += "</table>\n"; } else if (typeName.equals("boolean")) { - logger.debug("in boolean if"); - -// result += "<input type=\"checkbox\" name=\""+aname+"\" value=\"true\""; -// if(requestVal != null && requestVal.equals("true")) -// result += " checked "; - // result += ">"; - result = "<input type=\"radio\" name=\"" + aname + "\""; - - result += " value=\"true\""; - - if ((requestVal != null) && requestVal.equals("true")) { - result += " checked=\"checked\""; - } - - if (readonly) { - result += " readonly=\"readonly\""; - } - - result += "> true </input><input type=\"radio\""; - result += (" name=\"" + aname + "\" value=\"false\""); - - if ((requestVal != null) && requestVal.equals("false")) { - result += " checked=\"checked\""; - } - - if (readonly) { - result += " readonly=\"readonly\""; - } - - result += "> false </input>"; -// result += "<input type=\"radio\""; -// result += (" name=\"" + aname + "\" value=\"\""); -// -// if ((defaultVal != null) && defaultVal.equals("")) { -// result += " checked=\"checked\""; -// } -// -// if (readonly) { -// result += " readonly=\"readonly\""; -// } -// -// result += "> no value </input>"; - - + result += " value=\"true\""; + if ((requestVal != null) && requestVal.equals("true")) { + result += " checked=\"checked\""; + } + if (readonly) { + result += " readonly=\"readonly\""; + } + result += "> true </input><input type=\"radio\""; + result += (" name=\"" + aname + "\" value=\"false\""); + if ((requestVal != null) && requestVal.equals("false")) { + result += " checked=\"checked\""; + } + if (readonly) { + result += " readonly=\"readonly\""; + } + result += "> false </input>"; } else if ((rows <= 1)) { - logger.debug("rows <= 1"); result += ("<input name=\"" + aname + "\" type=\"text\""); - if (maxLength > -1) { if (maxLength > MAX_NUMBER_COLS) { rows = (maxLength / MAX_NUMBER_COLS) + 1; - return printAttrInput(categoryClass, aname, lang, requestVal, rows, MAX_NUMBER_COLS, readonly); } else { @@ -686,7 +655,6 @@ .toLocalizedPattern() + ")"); } } else { - logger.debug("in the else branch"); result += ("<textarea name=\"" + aname + "\""); result += (" cols=\"" + cols + "\" rows=\"" + rows + "\""); @@ -704,8 +672,6 @@ result += "</textarea>"; } - logger.debug("result: "+result); - return result; } @@ -942,7 +908,6 @@ boolean multiple, boolean readonly) { - logger.debug("in printDropDown"); String result = "<select name=\"" + submitName + "\""; if (type.equals("language")) { Index: CategoryServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/CategoryServlet.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- CategoryServlet.java 2 May 2006 11:55:41 -0000 1.15 +++ CategoryServlet.java 27 Jun 2006 10:13:12 -0000 1.16 @@ -263,8 +263,8 @@ // now update the category try { categoryManager. - updateCategory(catid, attrs, prequest.getPortalUser().getUser()); - + updateCategory(catid, attrs, + prequest.getPortalUser().getUser()); prequest.setReturnCode(1013); return "success"; Index: Category.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/Category.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Category.java 27 Jun 2006 09:27:37 -0000 1.15 +++ Category.java 27 Jun 2006 10:13:12 -0000 1.16 @@ -238,7 +238,10 @@ setOntologyClassName(avalue.toString()); } else if (aname.equals("parent")) { if (avalue instanceof Integer) - parentid = ((Integer)avalue).intValue(); + parentid = ((Integer)avalue).intValue(); + else { + parentid = Integer.parseInt(avalue.toString()); + } } else { super.setAttribute(aname, avalue); } Index: CategoryManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/CategoryManagerImpl.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- CategoryManagerImpl.java 30 May 2006 14:32:00 -0000 1.28 +++ CategoryManagerImpl.java 27 Jun 2006 10:13:12 -0000 1.29 @@ -798,7 +798,6 @@ } // reload object in cache - // TBD categoryCache.removeFromCache(catid); // and send an event ... @@ -816,7 +815,6 @@ logger.error(LogUtil.ex("Failed updating category", e)); } - //return result; } |