You can subscribe to this list here.
| 2004 |
Jan
|
Feb
(11) |
Mar
(106) |
Apr
(146) |
May
(79) |
Jun
(233) |
Jul
(218) |
Aug
(160) |
Sep
(155) |
Oct
(80) |
Nov
(176) |
Dec
(115) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(77) |
Feb
(106) |
Mar
(10) |
Apr
(54) |
May
(29) |
Jun
(29) |
Jul
(65) |
Aug
(80) |
Sep
|
Oct
(42) |
Nov
(45) |
Dec
(33) |
| 2006 |
Jan
(49) |
Feb
(52) |
Mar
(8) |
Apr
(3) |
May
(108) |
Jun
(43) |
Jul
(13) |
Aug
(1) |
Sep
(58) |
Oct
(66) |
Nov
(70) |
Dec
(115) |
| 2007 |
Jan
(26) |
Feb
(3) |
Mar
(17) |
Apr
(1) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
| 2009 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:07
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/item Modified Files: ItemPresenter.java Log Message: Index: ItemPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemPresenter.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- ItemPresenter.java 29 Nov 2006 15:15:58 -0000 1.56 +++ ItemPresenter.java 30 Nov 2006 14:02:00 -0000 1.57 @@ -1757,6 +1757,22 @@ return getCategoryOptions(categoryclassname, lang, null); } + public String getCategoryOptions(String categoryclassname, + String lang, + Set selcat, + String defcat) + { + if (defcat!=null && defcat.length()>0) { + if (selcat == null) + selcat = new HashSet(); + try { + Integer i = new Integer(Integer.parseInt(defcat)); + selcat.add(i); + } catch (Exception e) { } + } + return getCategoryOptions(categoryclassname, lang, selcat); + } + /** * */ |
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:05
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/core Modified Files: DataObjectCache.java OntologyDataType.java Log Message: Index: DataObjectCache.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/DataObjectCache.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DataObjectCache.java 27 Jun 2006 10:13:01 -0000 1.2 +++ DataObjectCache.java 30 Nov 2006 14:01:58 -0000 1.3 @@ -232,9 +232,6 @@ + new Integer(localid).toString()); this.objectsGlobal.remove(o.getGlobalId()); this.objectsLocal.remove(new Integer(o.getId())); - } else { - logger.warn("removing from cache problem - DataObject not found: " - + localid); } } Index: OntologyDataType.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/OntologyDataType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- OntologyDataType.java 22 Aug 2005 13:52:06 -0000 1.5 +++ OntologyDataType.java 30 Nov 2006 14:01:58 -0000 1.6 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Cobricks Group. All rights reserved. + * Copyright (c) 2004-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -18,6 +18,7 @@ * ontology data type. * * @author Johannes Mathes ma...@in... + * @author Michael Koch */ public class OntologyDataType |
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:05
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/course In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/course Modified Files: CourseManager.java CourseManagerImpl.java CourseModule.java CoursePresenter.java CourseServlet.java Log Message: Index: CoursePresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CoursePresenter.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- CoursePresenter.java 24 Nov 2006 08:05:56 -0000 1.24 +++ CoursePresenter.java 30 Nov 2006 14:01:59 -0000 1.25 @@ -303,7 +303,8 @@ return null; } - public CourseProgram getCourseProgram(String cpid) { + public CourseProgram getCourseProgram(String cpid) + { try { return courseManager.getProgram(Integer.parseInt(cpid.trim())); } catch(Exception e ){ @@ -323,6 +324,27 @@ return null; } + public CourseSubProgram getCourseSubProgram(String cspid) + { + try { + return courseManager.getSubProgram(Integer.parseInt(cspid.trim())); + } catch(Exception e ){ + logger.error(LogUtil.ex("Failed getting course sub program.", e)); + } + return null; + } + + public List searchCourseSubPrograms(String query) + { + logger.debug("Search course sub programs : "+query); + try { + return courseManager.searchSubPrograms(parseQuery(query)); + } catch (Exception e) { + logger.error(LogUtil.ex("Failed searching course sub programs.", e)); + } + return null; + } + public Map getTimetable(String userid, String term) { Map result = new HashMap(); Index: CourseServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseServlet.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- CourseServlet.java 24 Nov 2006 08:05:56 -0000 1.24 +++ CourseServlet.java 30 Nov 2006 14:01:59 -0000 1.25 @@ -36,7 +36,7 @@ /** * This class enhances the possibilities of the templates by offering methods * for manipulating(over web) of courses, coursemodules, courserooms, - * courselecturers and courseprograms + * courselecturers and course programs * * @author mic...@ac... * @version $Date$ @@ -84,6 +84,12 @@ "", true); this.addTarget("deletecourseprogram","performDeleteCourseProgram", "", true); + this.addTarget("createcoursesubprogram", + "performCreateCourseSubProgram", "", true); + this.addTarget("updatecoursesubprogram", + "performUpdateCourseSubProgram", "", true); + this.addTarget("deletecoursesubprogram", + "performDeleteCourseSubProgram", "", true); this.addTarget("addcoursett", "performAddCourseTT", "", true); this.addTarget("removecoursett", "performRemoveCourseTT", "", true); @@ -575,6 +581,38 @@ attrs.put("cpcomment_en"+i, tmps); } } + + maxcnt = 6; + tmps = prequest.getRequestParameter("cmsubprogcnt"); + if (tmps != null) { + try { + int tmpi = Integer.parseInt(tmps); + attrs.put("cmsubprogcnt", new Integer(tmpi)); + maxcnt = tmpi; + } catch (Exception e) { + attrs.put("cmsubprogcnt", new Integer(maxcnt)); + } + } + + for(int i=1; i<=maxcnt; i++ ){ + tmps = prequest.getRequestParameter("cspid"+i); + if (tmps != null) { + try { + int tmpi = Integer.parseInt(tmps); + attrs.put("cspid"+i, new Integer(tmpi)); + } catch (Exception e) { } + } + attrs.put("csppos"+i, prequest.getRequestParameter("csppos"+i)); + tmps = prequest.getRequestParameter("cspcomment"+i); + if (tmps != null) { + attrs.put("cspcomment"+i, tmps); + } + tmps = prequest.getRequestParameter("cspcomment_en"+i); + if (tmps != null) { + attrs.put("cspcomment_en"+i, tmps); + } + } + return attrs; } @@ -1135,7 +1173,6 @@ } - /** * Performs the deletion of a specified course program * @param prequest Portal request to gather the data for the deletion of @@ -1172,13 +1209,157 @@ } - /** - * Adds course to the timetable of the current user - * @param prequest Portal request to gather the data for the action - * @param out Is not used. - * @return "error": In case there are errors, also a context object named - * errors is set (a Set of InputErrors). "success" If everything is o.k. - */ + /** + * Extract attributes needed for the further processing of the + * course sub program + * @param prequest + * @return a Map which contains the extracted course program attributes + */ + protected Map getCourseSubProgramRequestParameters(PortalRequest prequest) + { + Map attrs = new HashMap(); + String tmps = prequest.getRequestParameter("cspid"); + if (tmps != null) { + try { + int tmpi = Integer.parseInt(tmps); + attrs.put("cspid", new Integer(tmpi)); + } catch (Exception e) { } + } + tmps = prequest.getRequestParameter("cpid"); + if (tmps != null) { + try { + int tmpi = Integer.parseInt(tmps); + attrs.put("cpid", new Integer(tmpi)); + } catch (Exception e) { } + } + attrs.put("cspname", prequest.getRequestParameter("cspname")); + attrs.put("cspname_en", prequest.getRequestParameter("cspname_en")); + attrs.put("csplabel", prequest.getRequestParameter("csplabel")); + attrs.put("cptag", prequest.getRequestParameter("cptag")); + attrs.put("cspcomment", prequest.getRequestParameter("cspcomment")); + attrs.put("cspcomment_en", prequest. + getRequestParameter("cspcomment_en")); + return attrs; + } + + /** + * Performs course program creation + * @param prequest Portal request to gather the data for creating a new + * course program + * @param out Is not used. + * @return "error": In case there are errors, also a context object named + * errors is set (a Set of InputErrors). "success" If everything is o.k. + */ + public String performCreateCourseSubProgram(PortalRequest prequest, + PrintWriter out) + { + logger.info("performCreateCourseSubProgram"); + + // check access rights + PortalUser portalUser = prequest.getPortalUser(); + /** TODO + if (!userManager.getAccessControl(). + checkPermission(portalUser.getUserId(), + "coursesubprogram", "create", null)) { + prequest.setReturnCode(2000); + return "noaccess"; + }*/ + + Map attrs = getCourseSubProgramRequestParameters(prequest); + + try { + int cspid = courseManager. + createSubProgram(attrs, portalUser.getUser()); + prequest.setReturnCode(1061); + return "success"; + } catch (Exception e) { + logger.error("Failed creating course sub program",e); + } + prequest.setReturnCode(2100); + return "error"; + } + + /** + * Updates the specified course program + * @param prequest Portal request to gather the data for updating a + * specified course program + * @param out Is not used. + * @return "error": In case there are errors, also a context object named + * errors is set (a Set of InputErrors). "success" If everything is o.k. + */ + public String performUpdateCourseSubProgram(PortalRequest prequest, + PrintWriter out) + { + logger.info("performUpdateCourseSubProgram"); + + // check access rights + PortalUser portalUser = prequest.getPortalUser(); + /** TODO + if (!userManager.getAccessControl(). + checkPermission(portalUser.getUserId(), + "coursesubprogram", "update", null)) { + prequest.setReturnCode(2000); + return "noaccess"; + }*/ + + Map attrs = getCourseSubProgramRequestParameters(prequest); + try { + int cspid = Integer. + parseInt(prequest.getRequestParameter("cspid")); + courseManager.updateSubProgram(cspid, attrs, portalUser.getUser()); + prequest.setReturnCode(1062); + return "success"; + } catch (Exception e) { + logger.error("Failed updating course sub program",e); + } + prequest.setReturnCode(2100); + return "error"; + } + + /** + * Performs the deletion of a specified course program + * @param prequest Portal request to gather the data for the deletion of + * the specified course program + * @param out Is not used. + * @return "error": In case there are errors, also a context object named + * errors is set (a Set of InputErrors). "success" If everything is o.k. + */ + public String performDeleteCourseSubProgram(PortalRequest prequest, + PrintWriter out) + { + logger.info("performDeleteCourseSubProgram"); + + // check access rights + PortalUser portalUser = prequest.getPortalUser(); + /** TODO + if (!userManager.getAccessControl(). + checkPermission(portalUser.getUserId(), + "coursesubprogram", "delete", null)) { + prequest.setReturnCode(2000); + return "noaccess"; + } */ + + try { + int cspid = Integer. + parseInt(prequest.getRequestParameter("cspid")); + courseManager.deleteSubProgram(cspid, portalUser.getUser()); + prequest.setReturnCode(1063); + return "success"; + } catch (Exception e) { + logger.error("Failed deleting courseprogram",e); + } + prequest.setReturnCode(2100); + return "error"; + } + + + /** + * Adds course to the timetable of the current user + * @param prequest Portal request to gather the data for the action + * @param out Is not used. + * @return "error": In case there are errors, also a context object named + * errors is set (a Set of InputErrors). "success" If everything is o.k. + */ public String performAddCourseTT(PortalRequest prequest, PrintWriter out) { Index: CourseManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManager.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- CourseManager.java 24 Nov 2006 08:05:56 -0000 1.32 +++ CourseManager.java 30 Nov 2006 14:01:59 -0000 1.33 @@ -217,6 +217,11 @@ public List getCourseModuleProgramRel(CourseModule cm) throws CobricksException; + public List getCourseModuleSubProgramRel(int cmid) + throws CobricksException; + public List getCourseModuleSubProgramRel(CourseModule cm) + throws CobricksException; + /** * This method is used to get a room out of the backend structure. * In case caching is activated, at first a lookup in the cache is performed. @@ -437,6 +442,73 @@ public void deleteProgram(int cpid, User user) throws CobricksException; + + /** + * This method is used to get a course program out of the backend structure. + * In case caching is activated, at first a lookup in the cache is performed. + * If this succeeds, the course program will be returned out of the cache. + * If it fails, the course program will be retrieved from the persistent + * structure (data base). + * + * @param cpid specifies the local id of the course program + * @return A course program object in case it was found, the null pointer + * otherwise. + * @throws CobricksException + */ + public CourseSubProgram getSubProgram(int cspid) + throws CobricksException; + + /** + * @param attrs + * @return + * @throws CobricksException + */ + public List searchSubPrograms(Map attrs) + throws CobricksException; + + /** + * This method creates a new course program object: + * At first the data is inserted into the persistent storage, + * then instantiated, then (if activated) inserted into the cache + * and then returned. + * + * @param attrs Map containing all attributes. All attributes must have the + * correct Java type. + * There are some attributes which get a special handling: The ids are + * discarded in the create method (reason: they have to be assigned by the + * system). + * @param user an object which represents an user who is the creator of the + * course program object + * @throws CobricksException + * @return int which is the new id of the course program in the database, + * 0 if an error occurred. + */ + public int createSubProgram(Map attrs, User user) + throws CobricksException; + + /** + * @param cpid + * @param attrs + * @param user + * @throws CobricksException + */ + public void updateSubProgram(int cspid, Map attrs, User user) + throws CobricksException; + + /** + * This method deletes a course sub program from the persistent databases and + * from the course program's cache. + * + * @param cspid The local id is needed to determine the course subprogram to + * be deleted + * @param user The user objcet used to check if the user has the permission + * to do so (at this time not implemented). + * @throws CobricksException + */ + public void deleteSubProgram(int cspid, User user) + throws CobricksException; + + /** * @param userid * @param term @@ -490,6 +562,7 @@ public CourseProgram getProgramForLabel(String cplabel); public void addProgramToModule(Map attrs); + public void addSubProgramToModule(Map attrs); public List getProgramsForModule(int cmid); Index: CourseManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManagerImpl.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- CourseManagerImpl.java 24 Nov 2006 08:05:56 -0000 1.58 +++ CourseManagerImpl.java 30 Nov 2006 14:01:59 -0000 1.59 @@ -69,6 +69,7 @@ private Map courseRoomCache; private Map courseLecturerCache; private Map courseProgramCache; + private Map courseSubProgramCache; /** * The value of this variable has to be equivalent to the java setting. @@ -143,11 +144,7 @@ } // initialize cache - courseCache = new HashMap(); - courseModuleCache = new HashMap(); - courseRoomCache = new HashMap(); - courseLecturerCache = new HashMap(); - courseProgramCache = new HashMap(); + resetCache(); // register course manager in component directory ComponentDirectory componentDirectory = @@ -841,9 +838,16 @@ maxcnt = ((Integer)attrs.get("cmprogcnt")).intValue(); } catch(Exception ex) {} } + int maxcnt2 = 6; + if((Integer)attrs.get("cmsubprogcnt") != null) { + try{ + maxcnt2 = ((Integer)attrs.get("cmsubprogcnt")).intValue(); + } catch(Exception ex) {} + } try { cmid = dbAccess.sqlInsert("course_module", sqlAttrs); + // Removes all the relation before adding the new relation dbAccess.sqlDelete("course_progrel", "cmid = "+cmid); for(int i=1; i<=maxcnt; i++ ){ @@ -865,6 +869,25 @@ dbAccess.sqlInsert("course_progrel", sqlAttrs2); } } + + // Removes all the relation before adding the new relation + dbAccess.sqlDelete("course_subprogrel", "cmid = "+cmid); + for(int i=1; i<=maxcnt2; i++ ){ + Map sqlAttrs2 = new HashMap(); + if (attrs.get("cspid"+i) != null && + attrs.get("cspid"+i).toString() != "") { + sqlAttrs2.put("cmid", new Integer(cmid)); + Object o = attrs.get("cspid"+i); + if (o != null) sqlAttrs2.put("cspid", o); + o = attrs.get("csppos"+i); + if (o != null) sqlAttrs2.put("csppos", o); + o = attrs.get("cspcomment"+i); + if (o != null) sqlAttrs2.put("cspcomment", o); + o = attrs.get("cspcomment_en"+i); + if (o != null) sqlAttrs2.put("cspcomment_en", o); + dbAccess.sqlInsert("course_subprogrel", sqlAttrs2); + } + } } catch (Exception e) { logger.error("Failed inserting course module.", e); @@ -919,9 +942,16 @@ maxcnt = ((Integer)attrs.get("cmprogcnt")).intValue(); } catch(Exception ex) {} } + int maxcnt2 = 6; + if((Integer)attrs.get("cmsubprogcnt") != null) { + try{ + maxcnt2 = ((Integer)attrs.get("cmsubprogcnt")).intValue(); + } catch(Exception ex) {} + } try { dbAccess.sqlUpdate("course_module", sqlAttrs, cmid); + // Removes all the relation before adding the new relation dbAccess.sqlDelete("course_progrel", "cmid = "+cmid); for(int i=1; i<=maxcnt; i++ ){ @@ -943,6 +973,26 @@ dbAccess.sqlInsert("course_progrel", sqlAttrs2); } } + + // Removes all the relation before adding the new relation + dbAccess.sqlDelete("course_subprogrel", "cmid = "+cmid); + for(int i=1; i<=maxcnt2; i++ ){ + Map sqlAttrs2 = new HashMap(); + if( attrs.get("cspid"+i) != null && + attrs.get("cspid"+i).toString() != "") { + sqlAttrs2.put("cmid", new Integer(cmid)); + Object o = attrs.get("cspid"+i); + if (o != null) sqlAttrs2.put("cspid", o); + o = attrs.get("csppos"+i); + if (o != null) sqlAttrs2.put("csppos", o); + o = attrs.get("cspcomment"+i); + if (o != null) sqlAttrs2.put("cspcomment", o); + o = attrs.get("cspcomment_en"+i); + if (o != null) sqlAttrs2.put("cspcomment_en", o); + dbAccess.sqlInsert("course_subprogrel", sqlAttrs2); + } + } + } catch (Exception e) { logger.error("Failed updating course module.", e); } @@ -978,6 +1028,7 @@ // Removes all the programrelations dbAccess.sqlDelete("course_progrel", "cmid = "+cmid); + dbAccess.sqlDelete("course_subprogrel", "cmid = "+cmid); // update cache courseModuleCache.remove(new Integer(cmid)); @@ -1205,7 +1256,9 @@ /** * @see org.cobricks.course.CourseManager#getCourseRoom(int) */ - public CourseRoom getRoom(int crid) throws CobricksException { + public CourseRoom getRoom(int crid) + throws CobricksException + { CourseRoom result = (CourseRoom)courseRoomCache.get(new Integer(crid)); if (result != null) { //logger.info("returns courseroom from cache"); @@ -1223,6 +1276,7 @@ } return result; } + public CourseRoom getRoomForExtId(String crextid) { Map dbres = dbAccess.sqlQuerySingleRow("select * from course_room " + @@ -1340,7 +1394,9 @@ /** * @see org.cobricks.course.LecturerManager#deleteLecturer(int, org.cobricks.user.User) */ - public void deleteLecturer(int lid, User user) throws CobricksException { + public void deleteLecturer(int lid, User user) + throws CobricksException + { try { //database access dbAccess.sqlDelete("course_lecturer", lid); @@ -1438,9 +1494,10 @@ } return result; } + /** - * @see org.cobricks.course.ProgramManager#createProgram(java.util.Map, org.cobricks.user.User) + * @see org.cobricks.course.CourseManager#createProgram(java.util.Map, org.cobricks.user.User) */ public int createProgram(Map attrs, User user) throws CobricksException @@ -1466,7 +1523,7 @@ } /** - * @see org.cobricks.course.ProgramManager#updateProgram(int, java.util.Map, org.cobricks.user.User) + * @see org.cobricks.course.CourseManager#updateProgram(int, java.util.Map, org.cobricks.user.User) */ public void updateProgram(int cpid, Map attrs, User user) throws CobricksException @@ -1490,21 +1547,23 @@ } /** - * @see org.cobricks.course.ProgramManager#deleteProgram(int, org.cobricks.user.User) + * @see org.cobricks.course.CourseManager#deleteProgram(int, org.cobricks.user.User) */ - public void deleteProgram(int cpid, User user) throws CobricksException { + public void deleteProgram(int cpid, User user) + throws CobricksException + { try { //database access dbAccess.sqlDelete("course_prog", cpid); // update cache courseProgramCache.remove(new Integer(cpid)); } catch (Exception e) { - logger.error("Failed deleting courseprogram.", e); + logger.error("Failed deleting course program.", e); } } /** - * @see org.cobricks.course.ProgramManager#getProgram(int) + * @see org.cobricks.course.CourseManager#getProgram(int) */ public CourseProgram getProgram(int cpid) throws CobricksException @@ -1527,7 +1586,7 @@ } /** - * @see org.cobricks.course.ProgramManager#getProgramAsXML(int) + * @see org.cobricks.course.CourseManager#getProgramAsXML(int) */ public String getProgramAsXML(int cpid) throws CobricksException @@ -1539,7 +1598,7 @@ } /** - * @see org.cobricks.course.ProgramManager#searchPrograms(java.util.Map) + * @see org.cobricks.course.CourseManager#searchPrograms(java.util.Map) */ public List searchPrograms(Map attrs) throws CobricksException { // display all courselecuturers by default @@ -1551,19 +1610,181 @@ if(attrs.get("cpname")!=null) where += "AND cpname like '%"+attrs.get("cpname")+"%' "; sql = "SELECT * FROM course_prog "+where+" ORDER BY cpname"; } -// logger.debug("Search Courseprograms : ("+sql+")"); List sqlList = dbAccess.sqlQuery(sql); ListIterator i = sqlList.listIterator(); while (i.hasNext()) { Map m = (Map)i.next(); CourseProgram c = new CourseProgram(); c.loadFromMap(m, this); -// logger.info("Search Courseprograms Name : "+c.getName()); result.add(c); } return result; } + + /** + * @see org.cobricks.course.CourseManager#getCourseModuleSubProgramRel(int) + */ + public List getCourseModuleSubProgramRel(int cmid) + throws CobricksException + { + List result = new ArrayList(); + String sql = "select * from course_subprogrel where cmid = "+cmid+";"; + List sqlList = dbAccess.sqlQuery(sql); + ListIterator i = sqlList.listIterator(); + logger.info("Returns CourseModuleSubProgramRelation"); + while (i.hasNext()) { + Map m = (Map)i.next(); + CourseModuleSubProgramRel cmpr = new CourseModuleSubProgramRel(); + cmpr.loadFromMap(m, this); + result.add(cmpr); + } + return result; + } + + /** + * @see org.cobricks.course.CourseManager#getCourseModuleSubProgramRel(CourseModule) + */ + public List getCourseModuleSubProgramRel(CourseModule cm) + throws CobricksException + { + int cmid = cm.getId(); + List result = new ArrayList(); + String sql = "select * from course_subprogrel where cmid = "+cmid+";"; + List sqlList = dbAccess.sqlQuery(sql); + ListIterator i = sqlList.listIterator(); + logger.info("Returns CourseModuleSubProgramRelation"); + while (i.hasNext()) { + Map m = (Map)i.next(); + CourseModuleSubProgramRel cmpr = new CourseModuleSubProgramRel(); + cmpr.loadFromMap(m, this, cm); + result.add(cmpr); + } + return result; + } + + /** + * @see org.cobricks.course.CourseManager#createSubProgram(java.util.Map, org.cobricks.user.User) + */ + public int createSubProgram(Map attrs, User user) + throws CobricksException + { + int cspid = 0; + + // copy attributes + Map sqlAttrs = new HashMap(); + copyAttr("cpid", attrs, sqlAttrs); + copyAttr("cptag", attrs, sqlAttrs); + copyAttr("cspname", attrs, sqlAttrs); + copyAttr("cspname_en", attrs, sqlAttrs); + copyAttr("csplabel", attrs, sqlAttrs); + copyAttr("cspcomment", attrs, sqlAttrs); + copyAttr("cspcomment_en", attrs, sqlAttrs); + + try { + cspid = dbAccess.sqlInsert("course_subprog", sqlAttrs); + } catch (Exception e) { + logger.error("Failed inserting course sub program.", e); + } + // update cache + courseSubProgramCache.put(new Integer(cspid), getSubProgram(cspid)); + return cspid; + } + + /** + * @see org.cobricks.course.CourseManager#updateSubProgram(int, java.util.Map, org.cobricks.user.User) + */ + public void updateSubProgram(int cspid, Map attrs, User user) + throws CobricksException + { + // copy attributes + Map sqlAttrs = new HashMap(); + copyAttr("cpid", attrs, sqlAttrs); + copyAttr("cptag", attrs, sqlAttrs); + copyAttr("cspname", attrs, sqlAttrs); + copyAttr("cspname_en", attrs, sqlAttrs); + copyAttr("csplabel", attrs, sqlAttrs); + copyAttr("cspcomment", attrs, sqlAttrs); + copyAttr("cspcomment_en", attrs, sqlAttrs); + + try { + dbAccess.sqlUpdate("course_subprog", sqlAttrs, cspid); + } catch (Exception e) { + logger.error("Failed updating course sub program.", e); + } + // update cache + courseSubProgramCache.remove(new Integer(cspid)); + courseSubProgramCache.put(new Integer(cspid), getSubProgram(cspid)); + } + + /** + * @see org.cobricks.course.CourseManager#deleteSubProgram(int, org.cobricks.user.User) + */ + public void deleteSubProgram(int cspid, User user) + throws CobricksException + { + try { + // database access + dbAccess.sqlDelete("course_subprog", cspid); + // update cache + courseSubProgramCache.remove(new Integer(cspid)); + } catch (Exception e) { + logger.error("Failed deleting course sub program.", e); + } + } + + /** + * @see org.cobricks.course.CourseManager#getSubProgram(int) + */ + public CourseSubProgram getSubProgram(int cspid) + throws CobricksException + { + CourseSubProgram result = (CourseSubProgram) + courseSubProgramCache.get(new Integer(cspid)); + if (result != null) { + return result; + } + // load from database + Map dbres = dbAccess. + sqlQuerySingleRow("SELECT * FROM course_subprog WHERE cspid = " + +Integer.toString(cspid)); + if (!dbres.isEmpty()){ + result = new CourseSubProgram(); + result.loadFromMap(dbres, this); + courseSubProgramCache.put(new Integer(cspid), result); + } + return result; + } + + /** + * @see org.cobricks.course.CourseManager#searchSubPrograms(java.util.Map) + */ + public List searchSubPrograms(Map attrs) + throws CobricksException + { + logger.debug("Search course sub programs"); + List result = new ArrayList(); + String sql = "SELECT * FROM course_subprog ORDER BY csplabel"; + if(attrs.size()>0){ + String where = "where cspid = cspid "; + if (attrs.get("cspname")!=null) + where += "AND cspname like '%"+attrs.get("cspname")+"%' "; + if (attrs.get("csplabel")!=null) + where += "AND csplabel like '%"+attrs.get("csplabel")+"%' "; + sql = "SELECT * FROM course_subprog "+where+" ORDER BY csplabel"; + } + List sqlList = dbAccess.sqlQuery(sql); + ListIterator i = sqlList.listIterator(); + while (i.hasNext()) { + Map m = (Map)i.next(); + CourseSubProgram c = new CourseSubProgram(); + c.loadFromMap(m, this); + result.add(c); + } + return result; + } + + /** * Return a map cttid - course for the entries of the personal timetable * of user userid for the given term. @@ -1788,6 +2009,24 @@ } } + public CourseSubProgram getSubProgramForLabel(String csplabel) + { + Map dbres = + dbAccess.sqlQuerySingleRow("select * from course_subprog " + + "where csplabel = '"+csplabel+"'"); + logger.info("getSubProgram for label ( "+csplabel+" )"); + if (dbres.isEmpty()) return null; + else { + CourseSubProgram result = new CourseSubProgram(); + result.loadFromMap(dbres, this); + int cspid = result.getId(); + if(!courseSubProgramCache.containsValue(result)){ + courseSubProgramCache.put(new Integer(cspid), result); + } + return result; + } + } + public void addProgramToModule(Map attrs) { try { @@ -1806,8 +2045,28 @@ } catch(Exception e){ logger.error(LogUtil.ex("Failed inserting program to course",e)); } - - + } + + public void addSubProgramToModule(Map attrs) + { + try { + Integer id1 = (Integer)attrs.get("cmid"); + Integer id2 = (Integer)attrs.get("cspid"); + if (id1 == null || id2 == null) return; + int cmid = id1.intValue(); + int cspid = id2.intValue(); + if (attrs.get("csppos") == null) + attrs.put("csppos", ""); + if (attrs.get("cspcomment") == null) + attrs.put("cspcomment", ""); + if (attrs.get("cspcomment_en") == null) + attrs.put("cspcomment_en", ""); + dbAccess.sqlExecute("delete from course_subprogrel " + + "where cmid = "+cmid+" and cspid = "+cspid); + dbAccess.sqlInsert("course_subprogrel", attrs); + } catch(Exception e){ + logger.error(LogUtil.ex("Failed inserting sub program to course",e)); + } } public List getProgramsForModule(int cmid) @@ -1833,6 +2092,29 @@ return result; } + public List getSubProgramsForModule(int cmid) + { + logger.info("getSubProgramsForCourse for ctp ( "+cmid+" )"); + List result = new ArrayList(); + String sql = "select cspid from course_subprogrel where cmid = "+cmid; + List list = dbAccess.sqlQuery(sql); + Iterator it = list.listIterator(); + while(it.hasNext()){ + Map map = (Map)it.next(); + Integer cspid = (Integer)map.get("cspid"); + if (cspid != null){ + try { + CourseSubProgram csp = getSubProgram(cspid.intValue()); + result.add(csp); + } catch(Exception e) { + logger.error("Failed getting sub program " + + "for course : "+e.toString()); + } + } + } + return result; + } + public int getStartSemForModule(int cpid, int cmid) { logger.info("getStartSemForCourse for programId( "+cpid+" )..."); @@ -2013,4 +2295,18 @@ return 0; } + + /** + * + */ + public void resetCache() + { + courseCache = new HashMap(); + courseModuleCache = new HashMap(); + courseRoomCache = new HashMap(); + courseLecturerCache = new HashMap(); + courseProgramCache = new HashMap(); + courseSubProgramCache = new HashMap(); + } + } Index: CourseModule.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseModule.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CourseModule.java 24 Nov 2006 08:05:56 -0000 1.4 +++ CourseModule.java 30 Nov 2006 14:01:59 -0000 1.5 @@ -36,6 +36,7 @@ int cmid; List cmprogramrel; + List cmsprogramrel; Map attrs; @@ -248,6 +249,14 @@ } /** + * @return Returns the cmsprogramrel. + */ + public List getSubProgramRel() + { + return cmsprogramrel; + } + + /** * Load course attributes from a Map object - e.g. one retrieved * from a database */ @@ -266,6 +275,12 @@ } catch (Exception e) { logger.error(LogUtil.ex("Failed loading course template.", e)); } + try { + cmsprogramrel = + courseManager.getCourseModuleSubProgramRel(this); + } catch (Exception e) { + logger.error(LogUtil.ex("Failed loading course template.", e)); + } } } |
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:04
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/user Modified Files: AccessPermission.java Log Message: Index: AccessPermission.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/AccessPermission.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AccessPermission.java 24 Nov 2006 12:53:29 -0000 1.7 +++ AccessPermission.java 30 Nov 2006 14:02:00 -0000 1.8 @@ -187,7 +187,6 @@ while (i.hasNext()) { String aname = (String)i.next(); String avalue = (String)attrs.get(aname); - logger.error("3 "+aname+"="+avalue); // handle special keywords if (avalue.equalsIgnoreCase("ownuserid")) avalue = Integer.toString(user.getUserId()); @@ -202,13 +201,10 @@ if (objattrs == null) return false; Object o = objattrs.get(aname); - logger.error("4: "+objattrs); - logger.error("4: "+o); if (o != null) { String avalueaccess = (String)o.toString(); // TBD compare sets, wildcards - logger.error("compare "+avalueaccess+"-"+avalue); if (!avalueaccess.equalsIgnoreCase(avalue)) return false; } } |
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:04
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/portal Modified Files: PortalRequest.java Log Message: Index: PortalRequest.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalRequest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- PortalRequest.java 24 Nov 2006 08:05:57 -0000 1.23 +++ PortalRequest.java 30 Nov 2006 14:02:00 -0000 1.24 @@ -259,8 +259,9 @@ lang = st.nextToken(); } String preferedUserLang = portalUser.getUserPreferedLang(); - if (preferedUserLang != "") - lang = preferedUserLang; + if (preferedUserLang != null && preferedUserLang.length()>0) { + lang = preferedUserLang; + } String tmps = getCookie(request, "lang"); if (tmps != null) lang = tmps; if (request.getParameter("lang")!=null) { |
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:04
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/course/db In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/course/db Modified Files: tables.txt Log Message: Index: tables.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/db/tables.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tables.txt 22 Aug 2005 13:52:06 -0000 1.2 +++ tables.txt 30 Nov 2006 14:01:59 -0000 1.3 @@ -4,6 +4,8 @@ course_notes course_progrel course_prog +course_subprogrel +course_subprog course_room course_module course_timetable |
|
From: Michael K. <ko...@us...> - 2006-11-30 14:02:03
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25691/org/cobricks/core/db Modified Files: DBAccessImpl.java Log Message: Index: DBAccessImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccessImpl.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- DBAccessImpl.java 24 Nov 2006 12:53:29 -0000 1.29 +++ DBAccessImpl.java 30 Nov 2006 14:01:59 -0000 1.30 @@ -420,11 +420,18 @@ o = new Float(o.toString()); } } - if (o!=null) - logger.debug("setPrepared "+count+" "+type+" "+aname+": " - +o.getClass().getName()); - else + if (o!=null) { + if (o instanceof String) { + logger.debug("setPrepared "+count+" "+type+" "+aname+": " + +o.getClass().getName() + +"("+((String)o).length()+")"); + } else { + logger.debug("setPrepared "+count+" "+type+" "+aname+": " + +o.getClass().getName()); + } + } else { logger.debug("setPrepared "+count+" "+aname+": NULL"); + } // is the parameter a Set? - then convert it to a String // tbd ... not perfect yet |
|
From: Michael K. <ko...@us...> - 2006-11-29 15:23:04
|
Update of /cvsroot/cobricks/drehscheibe-in/src/de/tum/cobricks/course In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7929 Added Files: generateHTMLOverviews.java Log Message: --- NEW FILE: generateHTMLOverviews.java --- /* * Copyright (c) 2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software * License, either version 1.0 of the License, or (at your option) any * later version (see www.cobricks.org). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package de.tum.cobricks.course; import java.io.*; import java.net.*; import java.sql.*; import java.text.*; import java.util.Date; import java.util.*; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.cobricks.core.CobricksException; import org.cobricks.core.ComponentDirectory; import org.cobricks.core.CoreManager; import org.cobricks.core.db.DBAccess; import org.cobricks.core.util.DateUtil; import org.cobricks.core.util.LogUtil; import org.cobricks.core.util.PropertiesUtil; import org.cobricks.course.Course; import org.cobricks.course.CourseDate; import org.cobricks.course.CourseLecturer; import org.cobricks.course.CourseManager; import org.cobricks.course.CourseProgram; import org.cobricks.course.CourseRoom; import org.cobricks.user.UserManager; /** * Generate HTML files that list all lectures for one specific * study program. * * @author Michael Koch, TUM * @version $Date: 2006/11/29 15:22:57 $ */ public class generateHTMLOverviews { static Logger logger = Logger.getLogger(generateHTMLOverviews.class); static private CoreManager coreManager = null; static private DBAccess dbAccess; static final String ke = "<P><UL><LI>keine Einträge</UL>\n"; static String querysem; static int queryjahr; static String cterm; static CourseManager courseManager; static UserManager userManager; public static void main(String args[]) { String confdir = "WEB-INF/conf"; querysem = "WS"; queryjahr = 2006; if (args.length > 0) confdir = args[0]; if (args.length > 1) querysem = args[1]; if (args.length > 2) queryjahr = Integer.parseInt(args[2]); cterm = Integer.toString(queryjahr); if (querysem.equals("WS")) { cterm += "w"; } else { cterm += "s"; } generateHTMLOverviews o = new generateHTMLOverviews(confdir); o.doIt(); } /** * */ public generateHTMLOverviews(String confdir) { try { PropertyConfigurator. configure(confdir+File.separator+"log.properties"); } catch (Throwable e) { } // Instantiate CoreManager coreManager = new CoreManager(); // load Cobricks configuration (properties) Properties properties = new Properties(); properties.put("configdir", confdir); PropertiesUtil.loadProperties(confdir, properties, coreManager); // initialize CoreManager object ... try { coreManager.init(properties); } catch (CobricksException e) { System.err.println(e.toString()); System.exit(-1); } // initialize all the other components // this call instantiates all manager and presenter objects try { coreManager.initComponents(properties); } catch (Throwable e) { logger.error(LogUtil.ex("Failed initializing components.", e)); } this.dbAccess = coreManager.getDBAccess(); ComponentDirectory componentDirectory = coreManager.getComponentDirectory(); userManager = (UserManager) componentDirectory.getManager("userManager"); courseManager = (CourseManager) componentDirectory.getManager("courseManager"); } /** * */ public void doIt() { String filename = "vv" + querysem + Integer.toString(queryjahr); try { makeInformatik(new File(filename+"-info.html")); makeWirtschaftsinformatik(new File(filename+"-wi.html")); } catch (Exception e) { logger.error(LogUtil.ex("failed", e)); } } public static void printHeader(PrintWriter out) { if (querysem.equals("SS")) out.println("<h2>Sommersemester "+queryjahr+"</h2>"); else { int qpluseins = queryjahr + 1; out.println("<h2>Wintersemester "+queryjahr+"/"+ qpluseins+"</h2>"); } Date today = new Date(); DateFormat df = new SimpleDateFormat("dd.MM.yyy HH:mm"); df.setTimeZone(TimeZone.getTimeZone("ECT")); String outs = "<p>Diese Übersicht zeigt alle Veranstaltungen für das "+ "oben angegebene Semester (Stand: "+df.format(today)+").<p> "+ "(Geplante) Veranstaltungen anderer Semester oder "+ "<a href=\"/studium/studiengaenge/index.html\">"+ "anderer Studiengänge</a> können Sie über die "+ "<a href=\"/myintum/kurs_verwaltung/csearch.html\">"+ "Veranstaltungssuche</a> oder über die <a href=\""+ "/studium/vvindex.html\">Links "+ "zu anderen Veranstaltungsübersichten</a> finden.</p>"; out.println(outs); } public static void printFooter(PrintWriter out) { String outs = "\n<P><HR><P>"+ "Diese Seite wird aus Effizienzgründen nicht on-the-fly "+ "aus der Datenbasis generiert, sondern 'nur' zweimal "+ "täglich erstellt - ganz ganz ganz aktuelle "+ "Änderungen sind also nicht sofort hier "+ "zu sehen.<P>\n"+ "<p><a href=\"/studium/vvindex.html\">"+ "Veranstaltungsübersichten</a></p>"; out.println(outs); } public static void makeInformatik(File file) throws Exception { // PrintWriter out = new PrintWriter(new FileWriter(file)); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new java.io.FileOutputStream(file),"UTF8"))); out.println("$portalPresenter.parse(\"/pageheader.html\", $portalRequest)\n"); out.println("<H2>Studiengang Informatik (Diplom/Bachelor/Master)</h2><P>\n"); printHeader(out); out.println("<form action=\"/COURSE\" method=\"POST\">"); out.println("<input type=hidden name=\"cmd\" value=\"addcoursett\">"); out.println("<input type=hidden name=\"uid\" value=\"$userId\">"); out.println("<input type=hidden name=\"cmd.success\" value=\"/myintum/stundenplan/timetable.html\">"); out.println("<input type=hidden name=\"cmd.error\" value=\"/myintum/stundenplan/timetable.html\">"); out.println("<ul>"); out.println("<li><a href=\"#infbachelor\">Informatik Bachelor</a>\n"); out.println("<ul><li><a href=\"#bsi-vorl\">Vorlesungen</a>"); out.println("<li><a href=\"#bsi-sem\">Seminare und Proseminare</a>"); out.println("<li><a href=\"#bsi-prakt\">Praktika</a>"); out.println("</ul>"); out.println("<li><a href=\"#infmaster\">Informatik Master</a>\n"); out.println("<ul><li><a href=\"#msi-vorl\">Vorlesungen</a>"); out.println("<li><a href=\"#msi-sem\">Seminare und Proseminare</a>"); out.println("<li><a href=\"#msi-prakt\">Praktika</a>"); out.println("</ul>"); out.println("<li><a href=\"#infdipl\">Informatik Diplom</a>\n"); out.println("<ul><li><a href=\"#infdipl-vorl\">Vorlesungen</a>"); out.println("<li><a href=\"#infdipl-sem\">Seminare und Proseminare</a>"); out.println("<li><a href=\"#infdipl-prakt\">Praktika</a>"); out.println("</ul>"); out.println("</ul>"); int tmpi; out.println("<p><hr><a name=\"infbachelor\">" +"<p><h2>Informatik Bachelor</h2>"); out.println("<P><a name=\"bsi-vorl\"></a><h3>Vorlesungen</h3>"); tmpi = getData(out, "BS-INF", "Vorlesung", ""); tmpi += getData(out, "BS-INF", "Ãbung", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"bsi-sem\"></a><h3>Seminare</h3>"); tmpi = getData(out, "BS-INF", "Seminar", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"bsi-prakt\"></a><h3>Praktika</h3>"); tmpi = getData(out, "BS-INF", "Praktikum", ""); if (tmpi < 1) { out.println(ke); } out.println("<input type=submit "+ "value=\"Selektierte Veranstaltungen in Stundenplan "+ "aufnehmen\">"); out.println("<p><hr><a name=\"infmaster\">" +"<p><h2>Informatik Master</h2>"); out.println("<P><a name=\"msi-vorl\"></a><h3>Vorlesungen</h3>"); tmpi = getData(out, "MS-INF", "Vorlesung", ""); tmpi += getData(out, "MS-INF", "Ãbung", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"msi-sem\"></a><h3>Seminare</h3>"); tmpi = getData(out, "MS-INF", "Seminar", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"msi-prakt\"></a><h3>Praktika</h3>"); tmpi = getData(out, "MS-INF", "Praktikum", ""); if (tmpi < 1) { out.println(ke); } out.println("<input type=submit "+ "value=\"Selektierte Veranstaltungen in Stundenplan "+ "aufnehmen\">"); out.println("<p><hr><a name=\"infdiplom\">" +"<p><h2>Informatik Diplom</h2>"); out.println("<P><a name=\"infdiplom-vorl\"></a><h3>Vorlesungen</h3>"); tmpi = getData(out, "INF", "Vorlesung", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"infdiplom-sem\"></a><h3>Seminare</h3>"); tmpi = getData(out, "INF", "Seminar", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"infdiplom-prakt\"></a><h3>Praktika</h3>"); tmpi = getData(out, "INF", "Praktikum", ""); if (tmpi < 1) { out.println(ke); } out.println("<input type=submit "+ "value=\"Selektierte Veranstaltungen in Stundenplan "+ "aufnehmen\">"); out.println("</form>"); printFooter(out); out.println("\n$portalPresenter.parse(\"/pagefooter.html\", $portalRequest)"); out.flush(); out.close(); } public static void makeWirtschaftsinformatik(File file) throws Exception { // PrintWriter out = new PrintWriter(new FileWriter(file)); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new java.io.FileOutputStream(file),"UTF8"))); out.println("$portalPresenter.parse(\"/pageheader.html\", $portalRequest)\n"); out.println("<H2>Studiengang Wirtschaftsinformatik (Bachelor/Master)</h2><P>\n"); printHeader(out); out.println("<form action=\"/COURSE\" method=\"POST\">"); out.println("<input type=hidden name=\"cmd\" value=\"addcoursett\">"); out.println("<input type=hidden name=\"uid\" value=\"$userId\">"); out.println("<input type=hidden name=\"cmd.success\" value=\"/myintum/stundenplan/index.html\">"); out.println("<input type=hidden name=\"cmd.error\" value=\"/myintum/stundenplan/index.html\">"); out.println("<ul>"); out.println("<LI><a href=\"#winfbachelor\">Wirtschaftsinformatik Bachelor</a>\n"); out.println("<ul><li><a href=\"#bswi-vorl\">Vorlesungen</a>"); out.println("<li><a href=\"#bswi-sem\">Seminare und Proseminare</a>"); out.println("<li><a href=\"#bswi-prakt\">Praktika</a>"); out.println("</ul>"); out.println("<LI><a href=\"#winfms\">Wirtschaftsinformatik Master</a>\n"); out.println("<ul><li><a href=\"#mswi-vorl\">Vorlesungen</a>"); out.println("<li><a href=\"#mswi-sem\">Seminare</a>"); out.println("<li><a href=\"#mswi-prakt\">Praktika</a>"); out.println("</ul>"); out.println("</ul>"); out.println("<P>\n"); int tmpi; out.println("<p><hr><a name=\"winfbachelor\"><P>"+ "<h2>Wirtschaftsinformatik Bachelor</h2>"); out.println("<P><a name=\"bswi-vorl\"></a><h4>Vorlesungen</h4>"); tmpi = getData(out, "BS-WIRTINF", "Vorlesung", ""); tmpi += getData(out, "BS-WIRTINF", "Ãbung", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"bswi-sem\"></a><h4>Proseminare/Seminare</h4>"); tmpi = getData(out, "BS-WIRTINF", "Proseminar", ""); tmpi = getData(out, "BS-WIRTINF", "Seminar", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"bswi-prakt\"></a><h4>Praktika</h4>"); tmpi = getData(out, "BS-WIRTINF", "Praktikum", ""); if (tmpi < 1) { out.println(ke); } out.println("<input type=submit "+ "value=\"Selektierte Veranstaltungen in Stundenplan "+ "aufnehmen\">"); out.println("</form>"); printFooter(out); out.println("<p><hr><a name=\"winfms\"><P>"+ "<h2>Wirtschaftsinformatik Master</h2>"); out.println("<P><a name=\"mswi-vorl\"></a><h4>Vorlesungen</h4>"); tmpi = getData(out, "MS-WIRTINF", "Vorlesung", ""); tmpi += getData(out, "MS-WIRTINF", "Ãbung", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"mswi-sem\"></a><h4>Seminare</h4>"); tmpi = getData(out, "MS-WIRTINF", "Seminar", ""); if (tmpi < 1) { out.println(ke); } out.println("<P><a name=\"mswi-prakt\"></a><h4>Praktika</h4>"); tmpi = getData(out, "MS-WIRTINF", "Praktikum", ""); if (tmpi < 1) { out.println(ke); } out.println("<input type=submit "+ "value=\"Selektierte Veranstaltungen in Stundenplan "+ "aufnehmen\">"); out.println("</form>"); out.println("\n$portalPresenter.parse(\"/pagefooter.html\", $portalRequest)"); out.flush(); out.close(); } /** * */ static int getData(PrintWriter out, String nameunivis, String typ, String wkz) throws Exception { Map attrs = new HashMap(); CourseProgram cp = courseManager.getProgramForLabel(nameunivis); if (cp == null) { logger.error("did not find course program for "+nameunivis); return 0; } attrs.put("cpid", new Integer(cp.getId())); if (typ.length()>0) { attrs.put("cmtype", typ); } if (wkz!=null && wkz.length()>0) { attrs.put("coursetype", wkz); } attrs.put("cterm", cterm); List clist = courseManager.searchCourses(attrs, "course_module.cmname"); int fullcount = 0; out.println("<UL>"); Date today = new Date(); long todayTime = today.getTime(); Iterator i = clist.iterator(); while (i.hasNext()) { fullcount++; Course c = (Course)i.next(); long valctime = 0; Date d = c.getLastUpdate(); if (d != null) { valctime = d.getTime(); } out.print("<li>"); String vaurl = c.getUrl(); if (vaurl!=null && vaurl.length()>0) { out.print("<a href=\""+vaurl+"\">"); } String vatitel = c.getFullName(); out.print(vatitel); if (vaurl!=null && vaurl.length()>0) { out.print("</a>"); } int vasws = c.getHoursLecture() +c.getHoursSeminar()+c.getHoursLab(); out.print(" <i>("+getDozenten(c)+")</i>, "+vasws); if (c.getHoursExercises() > 0) { out.print("+"+c.getHoursExercises()); } out.println(" SWS"); long tdiff = todayTime - valctime; if (tdiff < 605000000) { if (tdiff < 173000000) { out.print(" <IMG SRC=\"/images/image-changed.gif\" alt=\"(changed in letzten zwei Tagen)\">"); } else if (tdiff < 346000000) { out.print(" <IMG SRC=\"/images/image-changed2.gif\" alt=\"(changed in letzten vier Tagen)\">"); } else { out.print(" <IMG SRC=\"/images/image-changed3.gif\" alt=\"(changed in letzter Woche)\">"); } } out.print("<input type=checkbox name=cid value=\"" +c.getId()+"\">"); StringBuffer termine = new StringBuffer(""); StringBuffer termineue = new StringBuffer(""); StringBuffer terminezue = new StringBuffer(""); int count = 0; List cdates = c.getCourseDates(); Iterator i2 = cdates.iterator(); while (i2.hasNext()) { CourseDate cd = (CourseDate)i2.next(); int tewotag = cd.getWeekday(); int teanstd = cd.getStartHour(); int teanmin = cd.getStartMin(); int teenstd = cd.getEndHour(); int teenmin = cd.getEndMin(); Date teandat = cd.getStartDate(); Date teendat = cd.getEndDate(); char tetyp = cd.getType(); CourseRoom room = cd.getRoom(); int teturnus = cd.getCycle(); StringBuffer tmpsb = new StringBuffer(""); switch (tewotag) { case 0: tmpsb.append("So "); break; case 1: tmpsb.append("Mo "); break; case 2: tmpsb.append("Di "); break; case 3: tmpsb.append("Mi "); break; case 4: tmpsb.append("Do "); break; case 5: tmpsb.append("Fr "); break; case 6: tmpsb.append("Sa "); break; } tmpsb.append(teanstd+":"+min2string(teanmin)+" - "+ teenstd+":"+min2string(teenmin)+" "); if (room != null) { tmpsb.append(room.getName()); } if (teandat != null) { if (teturnus >= 1) { tmpsb.append(" ab "+DateUtil. date2String(teandat, "dd.MM.yyyy")); if (teturnus > 1) { tmpsb.append(" alle "+teturnus+" Wochen"); } } else { if (teendat==null) tmpsb.append(" am "+DateUtil. date2String(teandat, "dd.MM.yyyy")); else tmpsb.append(" ab "+DateUtil. date2String(teandat, "dd.MM.yyyy")); } } if (teendat != null) { tmpsb.append(" bis "+DateUtil. date2String(teendat, "dd.MM.yyyy")); } if (tetyp == 'Z') { if (terminezue.length()<1) { terminezue.append(" Zentralübung "); } else { terminezue.append(", "); } terminezue.append(tmpsb.toString()); } else if (tetyp == 'U') { if (termineue.length()<1) { termineue.append(" Ãbung "); } else { termineue.append(", "); } termineue.append(tmpsb.toString()); } else { if (termine.length()>0) { termine.append(", "); } termine.append(tmpsb.toString()); } count ++; } out.println("<br>"+termine.toString()); if (terminezue.length()>0) out.println("<br>"+terminezue.toString()); if (termineue.length()>0) out.println("<br>"+termineue.toString()); String vacomment = c.getComment(); if (vacomment!=null && vacomment.trim().length()>0) { out.println("<br>\n"+vacomment); } } out.println("</UL>"); return fullcount; } static private String getDozenten(Course course) throws SQLException { List llist = courseManager.getLecturersForCourse(course.getId()); StringBuffer result = new StringBuffer(""); int count = 0; Iterator i = llist.iterator(); while (i.hasNext()) { CourseLecturer l = (CourseLecturer)i.next(); if (count > 0) result.append(", "); String doname = l.getLastName(); String dovorname = l.getFirstName(); String dourl = l.getUrl(); if (dourl!=null && dourl.length()>0) { result.append("<a href=\""+dourl+"\" target=_top>"); } result.append(doname); if (dovorname!=null && dovorname.length()>0) { result.append(" "+dovorname.substring(0, 1)+"."); } if (dourl!=null && dourl.length()>0) { result.append("</a>"); } count++; } return result.toString(); } static private String min2string(int min) { if (min < 10) return new String("0"+Integer.toString(min)); else return Integer.toString(min); } } |
|
From: Michael K. <ko...@us...> - 2006-11-29 15:16:11
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item/db In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6325/db Modified Files: item_attachment.xml Log Message: Index: item_attachment.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/db/item_attachment.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- item_attachment.xml 18 Oct 2006 16:47:50 -0000 1.4 +++ item_attachment.xml 29 Nov 2006 15:15:59 -0000 1.5 @@ -4,7 +4,7 @@ <column name="attachid" type="int" primarykey="true"/> <column name="itemid" type="int" notnull="true"/> - <column name="name" type="string(50)"/> + <column name="name" type="string(100)"/> <column name="comment" type="string(200)"/> <column name="mimetype" type="string(30)"/> <column name="asize" type="int"/> |
|
From: Michael K. <ko...@us...> - 2006-11-29 15:16:05
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6325 Modified Files: ItemAccessHandler.java ItemManagerImpl.java ItemPresenter.java ItemSearch.java itemontology.xml Log Message: Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- ItemManagerImpl.java 24 Nov 2006 12:53:29 -0000 1.76 +++ ItemManagerImpl.java 29 Nov 2006 15:15:58 -0000 1.77 @@ -761,7 +761,7 @@ try { item = getItem(id); } catch (CobricksException e) { - return null; + continue; } if (item != null) { list.add(item); @@ -773,6 +773,8 @@ } if (sortby != null) { + if (sortby.equals("title")) + sortby = "title_de"; list = sortItemsByAttribute(list, sortby); } @@ -795,6 +797,7 @@ { if (itemList == null) return null; logger.info("sortItems by " + orderAttribute); + /* brauchen wir nicht mehr ... (loeschen von items, die das angegebene attribut nicht definieren) Iterator i = itemList.iterator(); @@ -809,9 +812,12 @@ } } */ + ItemComparator itemComparator = new ItemComparator(); itemComparator.orderAttributeName = orderAttribute; + Collections.sort(itemList, itemComparator); + return itemList; } @@ -1645,6 +1651,19 @@ OntologyDataType ontType, String contextClass) { + // if datatype is string and a maximal length is defined + // then truncate value (if needed) + if (ontType != null) { + if (ontType.getTypeName().equals("string") + && ontType.getMaxLength()>0) { + String tmps = (String) avalue; + if (tmps.length()>ontType.getMaxLength()) { + tmps = tmps.substring(0, ontType.getMaxLength()); + avalue = tmps; + } + } + } + Map recordset = new HashMap(); String whereCondition = "itemid=" + String.valueOf(itemid); recordset.put("itemid", new Integer(itemid)); Index: ItemAccessHandler.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemAccessHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ItemAccessHandler.java 24 Nov 2006 12:53:29 -0000 1.5 +++ ItemAccessHandler.java 29 Nov 2006 15:15:58 -0000 1.6 @@ -128,15 +128,25 @@ if (attrs.get("itemid")!=null) { try { - Item item = itemManager.getItem((Integer)attrs.get("itemid")); - attrs = item.getAttributes(); + Object o = attrs.get("itemid"); + Integer itemid = null; + if (o instanceof Integer) { + itemid = (Integer)o; + } else { + try { + itemid = new Integer(Integer.parseInt(o.toString())); + } catch (Exception e) { } + } + if (itemid != null) { + Item item = itemManager.getItem(itemid); + attrs = item.getAttributes(); + } } catch (Exception e) { logger.warn(LogUtil.ex("failed", e)); } } // special handling of roleread and roleupdatae attributes - logger.error("!!!!!!!"); if (action.equals("read")) { String tmps = (String)attrs.get("roleread"); if (tmps!=null && tmps.length()>0) { Index: ItemPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemPresenter.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- ItemPresenter.java 24 Nov 2006 12:53:29 -0000 1.55 +++ ItemPresenter.java 29 Nov 2006 15:15:58 -0000 1.56 @@ -1580,15 +1580,17 @@ } xpath.append("]"); } else { - xpath.append("/item"); + // xpath.append("/item"); } // for category if (categories!=null && categories.size()>0) { - xpath.append(" and /item/categories/category["); + if (xpath.length()>0) + xpath.append(" and "); + xpath.append("/item/categories/category["); Iterator i = categories.iterator(); while (i.hasNext()) { - xpath.append("@id="); + xpath.append("id="); xpath.append(i.next().toString()); if (i.hasNext()) xpath.append(" or "); } Index: ItemSearch.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemSearch.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- ItemSearch.java 26 Oct 2006 10:38:25 -0000 1.28 +++ ItemSearch.java 29 Nov 2006 15:15:59 -0000 1.29 @@ -207,7 +207,6 @@ convertOperators(xPath, positions); } - return xPath.toString(); } Index: itemontology.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/itemontology.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- itemontology.xml 24 Nov 2006 08:05:56 -0000 1.13 +++ itemontology.xml 29 Nov 2006 15:15:59 -0000 1.14 @@ -22,7 +22,7 @@ <attr name="creationtime" type="datetime"/> <attr name="updater" type="user"/> <attr name="updatetime" type="datetime"/> -<attr name="location" type="string(50)"/> +<attr name="location" type="string(100)"/> <attr name="locationgeolat" type="string(20)"> <description lang="de">Breitengrad (WGS84)</description> <description lang="en">Latitude (WGS84)</description> |
|
From: Michael K. <ko...@us...> - 2006-11-24 12:53:37
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16330/org/cobricks/core/db Modified Files: DBAccess.java DBAccessImpl.java Log Message: Index: DBAccessImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccessImpl.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- DBAccessImpl.java 3 Nov 2006 07:22:13 -0000 1.28 +++ DBAccessImpl.java 24 Nov 2006 12:53:29 -0000 1.29 @@ -1229,19 +1229,21 @@ } - public void sqlExecute(String sql) + public String sqlExecute(String sql) { - sqlExecute(sql, false); + return sqlExecute(sql, false); } /** * Execute the given SQL statement. + * * @param donotlogerrors if true, then exceptions will not be logged */ - public void sqlExecute(String sql, boolean donotlogerrors) + public String sqlExecute(String sql, boolean donotlogerrors) { - if (sql==null || sql.trim().length()<1) return; + if (sql==null || sql.trim().length()<1) return ""; logger.debug("sqlExecute("+sql+")"); + String result = ""; Connection conn = null; Statement stmt = null; try { @@ -1252,13 +1254,16 @@ } catch(Exception e) { if (donotlogerrors) logger.error("Failed executing sql statement"); - else + else { logger.error(LogUtil.ex("Failed executing sql statement: " +sql, e)); + result = e.getMessage(); + } } finally { try { stmt.close(); } catch (Exception e) { } try { conn.close(); } catch (Exception e) { } } + return result; } Index: DBAccess.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccess.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- DBAccess.java 18 Oct 2006 16:47:49 -0000 1.11 +++ DBAccess.java 24 Nov 2006 12:53:28 -0000 1.12 @@ -67,8 +67,8 @@ public Map sqlQuerySingleRow(String sql); - public void sqlExecute(String sql); - public void sqlExecute(String sql, boolean donotlogerrors); + public String sqlExecute(String sql); + public String sqlExecute(String sql, boolean donotlogerrors); // create a new value for the primary key column of the given table public String getNewPrimaryKey(String tablename, String primarykeycol); |
|
From: Michael K. <ko...@us...> - 2006-11-24 12:53:33
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16330/org/cobricks/user Modified Files: AccessPermission.java AccessRole.java Log Message: Index: AccessRole.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/AccessRole.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AccessRole.java 7 Dec 2005 14:01:46 -0000 1.3 +++ AccessRole.java 24 Nov 2006 12:53:29 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Cobricks Group. All rights reserved. + * Copyright (c) 2003-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -14,7 +14,7 @@ import java.util.*; -import org.apache.log4j.*; +import org.apache.log4j.Logger; /** * @@ -160,6 +160,10 @@ public boolean isUser(int userid) { + if (roletype == ROLETYPE_AUTH) + return true; + if (roletype == ROLETYPE_ALL) + return true; if (users == null) return false; if (users.contains(new Integer(userid))) return true; Index: AccessPermission.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/AccessPermission.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AccessPermission.java 24 Nov 2006 08:05:57 -0000 1.6 +++ AccessPermission.java 24 Nov 2006 12:53:29 -0000 1.7 @@ -181,14 +181,18 @@ // ... the simplest case is if there are no restricting attributes if (attrs == null) return true; + if (attrs.size()<1) return true; Iterator i = attrs.keySet().iterator(); while (i.hasNext()) { String aname = (String)i.next(); String avalue = (String)attrs.get(aname); + logger.error("3 "+aname+"="+avalue); // handle special keywords if (avalue.equalsIgnoreCase("ownuserid")) avalue = Integer.toString(user.getUserId()); + if (avalue.equalsIgnoreCase("self")) + avalue = Integer.toString(user.getUserId()); if (avalue.equalsIgnoreCase("ownuserclass")) avalue = user.getUserClass(); if (avalue.equalsIgnoreCase("ownuserlogin")) @@ -198,11 +202,13 @@ if (objattrs == null) return false; Object o = objattrs.get(aname); + logger.error("4: "+objattrs); + logger.error("4: "+o); if (o != null) { String avalueaccess = (String)o.toString(); // TBD compare sets, wildcards - + logger.error("compare "+avalueaccess+"-"+avalue); if (!avalueaccess.equalsIgnoreCase(avalue)) return false; } } |
|
From: Michael K. <ko...@us...> - 2006-11-24 12:53:33
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/util/migration In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16330/org/cobricks/util/migration Modified Files: ItemMigration.java Log Message: Index: ItemMigration.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/util/migration/ItemMigration.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ItemMigration.java 18 Oct 2006 16:47:51 -0000 1.11 +++ ItemMigration.java 24 Nov 2006 12:53:29 -0000 1.12 @@ -330,9 +330,11 @@ String key = (String) i.next(); String value = (String) tmpMap.get(key); if (key.equals("restrictedaccess")) { - key = "permission"; + key = "roleread"; if (value.equals("no")) - value = "all"; + value = ""; + else + value = "mitarbeiter"; } toMap.put(key,value); } |
|
From: Michael K. <ko...@us...> - 2006-11-24 12:53:33
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16330/org/cobricks/item Modified Files: ItemAccessHandler.java ItemAttrs.java ItemManagerImpl.java ItemPresenter.java properties.txt Log Message: Index: ItemAttrs.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemAttrs.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- ItemAttrs.java 8 May 2006 07:47:59 -0000 1.40 +++ ItemAttrs.java 24 Nov 2006 12:53:29 -0000 1.41 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2005 Cobricks Group. All rights reserved. + * Copyright (c) 2004-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -74,7 +74,8 @@ */ private static final String[] TABLE_MAIN_PROPERTIES = { "globalid", "expirationtime", "starttime", "state", "origin", - "location", "creationtime", "endtime", "itemclass", "updatetime" + "location", "creationtime", "endtime", "itemclass", "updatetime", + "roleread", "roleupdate" }; /** @@ -458,13 +459,13 @@ */ protected static String escapeXML(String tmps) { - tmps = replace(tmps, "Ä", "Ä"); - tmps = replace(tmps, "ä", "ä"); - tmps = replace(tmps, "Ö", "Ö"); - tmps = replace(tmps, "ö", "ö"); - tmps = replace(tmps, "Ü", "Ü"); - tmps = replace(tmps, "ü", "ü"); - tmps = replace(tmps, "ß", "ß"); + tmps = replace(tmps, "Ã", "Ä"); + tmps = replace(tmps, "ä", "ä"); + tmps = replace(tmps, "Ã", "Ö"); + tmps = replace(tmps, "ö", "ö"); + tmps = replace(tmps, "Ã", "Ü"); + tmps = replace(tmps, "ü", "ü"); + tmps = replace(tmps, "Ã", "ß"); char ch = (char)132; tmps = tmps.replace(ch, ' '); ch = (char)145; Index: ItemAccessHandler.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemAccessHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ItemAccessHandler.java 24 Nov 2006 08:05:56 -0000 1.4 +++ ItemAccessHandler.java 24 Nov 2006 12:53:29 -0000 1.5 @@ -20,10 +20,13 @@ import org.cobricks.core.CoreManager; import org.cobricks.core.db.DBAccess; import org.cobricks.core.util.LogUtil; +import org.cobricks.item.Item; +import org.cobricks.item.ItemManager; import org.cobricks.user.AccessControl; import org.cobricks.user.AccessHandler; import org.cobricks.user.AccessHandlerAdaptor; import org.cobricks.user.AccessPermission; +import org.cobricks.user.AccessRole; import org.cobricks.user.User; import org.cobricks.user.UserManager; @@ -118,6 +121,49 @@ // we might construct a matching select here to let the database do // some optimization ... TBD + ComponentDirectory componentDirectory = + coreManager.getComponentDirectory(); + ItemManager itemManager = (ItemManager) + componentDirectory.getManager("itemManager"); + + if (attrs.get("itemid")!=null) { + try { + Item item = itemManager.getItem((Integer)attrs.get("itemid")); + attrs = item.getAttributes(); + } catch (Exception e) { + logger.warn(LogUtil.ex("failed", e)); + } + } + + // special handling of roleread and roleupdatae attributes + logger.error("!!!!!!!"); + if (action.equals("read")) { + String tmps = (String)attrs.get("roleread"); + if (tmps!=null && tmps.length()>0) { + // if user does not have role that deny access + AccessControl ac = userManager.getAccessControl(); + AccessRole ar = ac.getAccessRoleByName(tmps); + if (ar != null) { + // TBD: check "member(x)" + boolean b = ac.checkRole(userid, ar.getId()); + if (!b) return false; + } + } + } + if (action.equals("update")) { + String tmps = (String)attrs.get("roleupdate"); + if (tmps!=null && tmps.length()>0) { + // if user has role than grant access + AccessControl ac = userManager.getAccessControl(); + AccessRole ar = ac.getAccessRoleByName(tmps); + if (ar != null) { + // TBD: check "member(x)" + boolean b = ac.checkRole(userid, ar.getId()); + if (b) return true; + } + } + } + // get permissions of user AccessControl ac = userManager.getAccessControl(); List permissions = ac.getAccessPermissionsByUser(userid); @@ -127,7 +173,10 @@ while (i.hasNext()) { AccessPermission perm = (AccessPermission)i.next(); // check if this is the requested permission - if (perm.contains(user, domain, action, attrs)) return true; + if (perm.contains(user, domain, action, attrs)) { + logger.debug("found matching permission: "+perm.toString()); + return true; + } } return false; Index: ItemPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemPresenter.java,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- ItemPresenter.java 24 Nov 2006 08:05:56 -0000 1.54 +++ ItemPresenter.java 24 Nov 2006 12:53:29 -0000 1.55 @@ -836,7 +836,7 @@ } String value = ""; - if ((requestVal != null) && (requestVal.toString().length() > 0)) { + if (requestVal != null) { value = printAttribute(requestVal, lang); } else if (defaultVal != null) { value = defaultVal; Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- ItemManagerImpl.java 24 Nov 2006 08:05:56 -0000 1.75 +++ ItemManagerImpl.java 24 Nov 2006 12:53:29 -0000 1.76 @@ -84,7 +84,7 @@ /** * Component version */ - private static final String COMP_VERSION = "V0.4 (May 2006)"; + private static final String COMP_VERSION = "V0.5 (November 2006)"; /** * The default value for the object cache - used in case no property is found @@ -2157,7 +2157,8 @@ ComponentEvent event = new ComponentEventImpl("org.cobricks.item", "item", "update"); event.setObject(item); - User updater = (User)item.getAttributeQualified("updater", coreManager); + User updater = (User) + item.getAttributeQualified("updater", coreManager); if (updater != null) event.setUserId(updater.getId()); this.publishEvent(event); @@ -2711,9 +2712,17 @@ equals("file")) { String storageDirName = properties.getProperty("item.attachments.storage.filedir"); + if (!storageDirName.startsWith("/")) { + String webspaceDir = + properties.getProperty("portal.webspace.dir"); + storageDirName = webspaceDir + storageDirName; + } File storageDir = new File(storageDirName); - if (!storageDir.exists()) + if (!storageDir.exists()) { + logger.warn("item attachment storage dir " + +storageDirName+" does not exist."); storageDir.mkdirs(); + } String postfix = "bin"; if (fname != null && fname.indexOf(".")>-1) { postfix = fname.substring(fname.lastIndexOf(".")+1); @@ -2957,6 +2966,8 @@ attrs.put("itemid", new Integer(item.getId())); boolean b = userManager. checkPermission(user.getId(), "item", "read", attrs); + return b; + /* jetzt ist alles in AccessHandler drin if (!b) return false; // if okay than check roleread attribute String tmps = (String)item.getAttribute("roleread"); @@ -2971,6 +2982,7 @@ return false; } return true; + */ } public boolean checkReadPermission(Item item, int userid) @@ -2993,6 +3005,8 @@ attrs.put("itemid", new Integer(item.getId())); boolean b = userManager. checkPermission(user.getId(), "item", "update", attrs); + return b; + /* if (b) return true; // if not than check rolewrite attribute String tmps = (String)item.getAttribute("roleupdate"); @@ -3007,6 +3021,7 @@ return true; } return false; + */ } public boolean checkUpdatePermission(Item item, int userid) Index: properties.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/properties.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- properties.txt 24 Nov 2006 08:05:56 -0000 1.17 +++ properties.txt 24 Nov 2006 12:53:29 -0000 1.18 @@ -23,7 +23,7 @@ # item annotations item.attachments.storage=file -item.attachments.storage.filedir= +item.attachments.storage.filedir=attachments # xml database item.xmldb=false |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:16:01
|
Update of /cvsroot/cobricks/drehscheibe-in/web/WEB-INF In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32076 Modified Files: web.xml Log Message: Index: web.xml =================================================================== RCS file: /cvsroot/cobricks/drehscheibe-in/web/WEB-INF/web.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- web.xml 29 May 2006 07:37:16 -0000 1.2 +++ web.xml 24 Nov 2006 08:15:57 -0000 1.3 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" @@ -278,31 +278,7 @@ </filter> <filter-mapping> <filter-name>multipartFilter</filter-name> - <url-pattern>/PORTAL</url-pattern> - </filter-mapping> - <filter-mapping> - <filter-name>multipartFilter</filter-name> - <url-pattern>/USER</url-pattern> - </filter-mapping> - <filter-mapping> - <filter-name>multipartFilter</filter-name> - <url-pattern>/ITEM</url-pattern> - </filter-mapping> - <filter-mapping> - <filter-name>multipartFilter</filter-name> - <url-pattern>/CATEGORY</url-pattern> - </filter-mapping> - <filter-mapping> - <filter-name>multipartFilter</filter-name> - <url-pattern>/CONTEXT</url-pattern> - </filter-mapping> - <filter-mapping> - <filter-name>multipartFilter</filter-name> - <url-pattern>/MESSAGE</url-pattern> - </filter-mapping> - <filter-mapping> - <filter-name>multipartFilter</filter-name> - <url-pattern>/COURSE</url-pattern> + <url-pattern>/*</url-pattern> </filter-mapping> |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:35
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/item Modified Files: ItemAccessHandler.java ItemManager.java ItemManagerImpl.java ItemPresenter.java ItemServlet.java itemontology.xml properties.txt Log Message: Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -r1.74 -r1.75 --- ItemManagerImpl.java 9 Nov 2006 12:03:51 -0000 1.74 +++ ItemManagerImpl.java 24 Nov 2006 08:05:56 -0000 1.75 @@ -57,6 +57,7 @@ import org.cobricks.user.UserManager; import org.cobricks.user.AccessControl; import org.cobricks.user.AccessHandler; +import org.cobricks.user.AccessRole; /** * Implmentation of the ItemManager interface for storing items in the @@ -88,7 +89,7 @@ /** * The default value for the object cache - used in case no property is found */ - private static final int DEFAULT_CACHE_SIZE = 50; + private static final int DEFAULT_CACHE_SIZE = 5000; /** * Which attributes are used for permission checking? Maybe this will be @@ -706,6 +707,11 @@ * empty List of Items is returned. Otherwise null is returned. */ public List searchItems(String query) + { + return searchItems(query, null, -1); + } + + public List searchItems(String query, String sortby, int maxrows) { logger.info("searchItems(" + query + ")"); String result = null; @@ -742,12 +748,12 @@ // get item ids resultSet = ItemSearch.getIDsFromSQLQuery(query, this.ontology, this.dbAccess); - if (resultSet != null) { list = new ArrayList(); if (resultSet.size() > 0) { // Something was found Iterator iterator = resultSet.iterator(); + int count = 0; while (iterator.hasNext()) { // Get the id of this item int id = ((Integer)iterator.next()).intValue(); @@ -760,8 +766,16 @@ if (item != null) { list.add(item); } + count++; + if ((maxrows>0) && (count>=maxrows)) + break; } - } + } + + if (sortby != null) { + list = sortItemsByAttribute(list, sortby); + } + // Return the (potentially empty) List with Items logger.debug("searchItems() returns "+list.size()+" item(s)"); return list; @@ -781,16 +795,20 @@ { if (itemList == null) return null; logger.info("sortItems by " + orderAttribute); + /* brauchen wir nicht mehr ... (loeschen von items, die + das angegebene attribut nicht definieren) Iterator i = itemList.iterator(); while (i.hasNext()) { Item nextItem = (Item)i.next(); String nextAttribute = (String) nextItem.getAttribute(orderAttribute); - if (nextAttribute == null) { // Remove item if attribute does not exist! + if (nextAttribute == null) { + // Remove item if attribute does not exist! itemList.remove(nextItem); i = itemList.iterator(); } } + */ ItemComparator itemComparator = new ItemComparator(); itemComparator.orderAttributeName = orderAttribute; Collections.sort(itemList, itemComparator); @@ -805,6 +823,14 @@ Item i2 = (Item)b; Object o1 = i1.getAttribute(orderAttributeName); Object o2 = i2.getAttribute(orderAttributeName); + if (o2 == null) { + if (o1 == null) + return 0; + return 1; + } + if (o1 == null) { + return -1; + } if (o1 instanceof Integer) { Integer int1 = (Integer)o1; Integer int2 = (Integer)o2; @@ -823,6 +849,180 @@ /** + * @see org.cobricks.item.ItemManager#searchItems(java.util.Map,int) + */ + public List searchItems(Map query, String sortby, int maxrows) + throws CobricksException + { + if (sortby == null) + sortby = "creationtime"; + List itemclasses = null; + List categories = null; + Object o = query.get("itemclasses"); + if ((o != null) && (o instanceof List)) { + itemclasses = (List)o; + } + o = query.get("categories"); + if ((o != null) && (o instanceof List)) { + categories = (List)o; + } + int creatorid = -1; + o = query.get("creatorid"); + if ((o != null) && (o instanceof Integer)) { + creatorid = ((Integer)o).intValue(); + } + String title = null; + o = query.get("title"); + if ((o != null)) { + title = o.toString(); + } + + if (itemclasses == null) itemclasses = new ArrayList(); + if (categories == null) categories = new ArrayList(); + + StringBuffer sqlfrom = new StringBuffer("item"); + StringBuffer sqlwhere = new StringBuffer("itemid>0"); + + if (creatorid > 0) { + sqlfrom.append(" join item_attrsuser using(itemid)"); + sqlwhere.append(" and item_attrsuser.aname = 'creator'"); + sqlwhere.append(" and item_attrsuser.auserid = "+creatorid); + } + + if (title!=null && title.length()>0) { + sqlfrom.append(" join item_title using(itemid)"); + sqlwhere.append(" and item_title.title like '%"+title+"%'"); + } + + if (itemclasses!=null && itemclasses.size()>0) { + sqlwhere.append(" and ("); + Iterator i = itemclasses.iterator(); + while (i.hasNext()) { + sqlwhere.append("itemclass='"); + sqlwhere.append(i.next().toString()); + sqlwhere.append("'"); + if (i.hasNext()) sqlwhere.append(" or "); + } + sqlwhere.append(")"); + } + if (categories!=null && categories.size()>0) { + // TBD + } + + String sql = "select item.itemid from "+sqlfrom.toString() + +" where "+sqlwhere.toString(); + if (sortby.equals("itemid")) { + sql += " order by itemid"; + sortby = null; + } else if (sortby.equals("itemclass")) { + sql += " order by itemclass"; + sortby = null; + } else if (sortby.equals("creationtime")) { + sql += " order by creationtime desc"; + sortby = null; + } else if (sortby.equals("updatetime")) { + sql += " order by updatetime desc"; + sortby = null; + } else if (sortby.equals("starttime")) { + sql += " order by starttime"; + sortby = null; + } else if (sortby.equals("endtime")) { + sql += " order by endtime"; + sortby = null; + } else if (sortby.equals("expirationtime")) { + sql += " order by expirationtime"; + sortby = null; + } else if (sortby.equals("location")) { + sql += " order by location"; + sortby = null; + } else if (sortby.equals("origin")) { + sql += " order by origin"; + sortby = null; + } else { + sql += " order by creationtime desc"; + } + List itemids = dbAccess.sqlQuery(sql, maxrows); + + // now get item objects + List result = new ArrayList(); + Iterator i = itemids.iterator(); + while (i.hasNext()) { + Map m = (Map)i.next(); + Integer integer = (Integer)m.get("itemid"); + int itemid = integer.intValue(); + Item item = getItem(itemid); + if (item != null) result.add(item); + } + + if (sortby != null) { + result = sortItemsByAttribute(result, sortby); + } + + return result; + } + + + /** + * @see org.cobricks.item.ItemManager#searchItemsByPermission(int,java.lang.String,java.lang.String,java.util.List,java.util.List,int) + + Currently only permission=read,update work - + and everything is done using simple heuristics + */ + public List searchItemsByPermission(int userid, String permission, + String title, + List itemclasses, List categories, + int maxrows) + throws CobricksException + { + return searchItemsByPermission(userid, permission, title, + itemclasses, categories, + null, maxrows); + } + + public List searchItemsByPermission(int userid, String permission, + String title, + List itemclasses, List categories, + String sortby, int maxrows) + throws CobricksException + { + try { + if (userid<1) return null; + if (sortby!=null && sortby.length()<1) + sortby = null; + + Map attrs = new HashMap(); + if (title!=null) attrs.put("title", title); + if (itemclasses!=null) attrs.put("itemclasses", itemclasses); + if (categories!=null) attrs.put("categories", categories); + + if (permission == null) permission = "update"; + if (permission.equals("delete")) permission = "update"; + if (permission.equals("read")) { + // TBD: wirkliche Rechte prüfen + // TBD: roleread prüfen + return searchItems(attrs, sortby, maxrows); + } + if (permission.equals("update")) { + // TBD: wirkliche Rechte prüfen + UserManager userManager = (UserManager) coreManager. + getComponentDirectory().getManager("userManager"); + if (userManager.checkPermission(userid, "item", "update", null)) { + return searchItems(attrs, sortby, maxrows); + } else { + // TBD: roleupdate prüfen + logger.debug("searching items for user "+userid); + attrs.put("creatorid", new Integer(userid)); + return searchItems(attrs, sortby, maxrows); + } + } + } catch (Exception e) { + logger.error(LogUtil.ex("failed", e)); + } + return null; + } + + + /** * @see org.cobricks.item.ItemManager#addItemAnnotation(org.cobricks.item. * Item, org.cobricks.item.ItemAnnotation) */ @@ -2110,6 +2310,7 @@ /** * This method helps to perform a query to the user manager whether an * operation is allowed or not. + * * @param userid The given user id * @param item The item, needed to get other necessary attributes needed * for access checking. @@ -2186,7 +2387,8 @@ public List searchItemsByTimestamp(String aname, long avaluelow, long avaluehigh, boolean sortasc, boolean noexpired, - List itemclasses, List categories, + List itemclasses, + List categories, int maxrows) throws CobricksException { @@ -2740,4 +2942,79 @@ Item item = this.getItemFromCache(itemid); return item.getContent(); } + + + /** + * + */ + public boolean checkReadPermission(Item item, User user) + { + logger.debug("checkReadPermission "+item+","+user); + UserManager userManager = (UserManager) coreManager. + getComponentDirectory().getManager("userManager"); + // check permission + Map attrs = new HashMap(); + attrs.put("itemid", new Integer(item.getId())); + boolean b = userManager. + checkPermission(user.getId(), "item", "read", attrs); + if (!b) return false; + // if okay than check roleread attribute + String tmps = (String)item.getAttribute("roleread"); + if (tmps!=null && tmps.length()>0) { + AccessControl ac = userManager.getAccessControl(); + AccessRole ar = ac.getAccessRoleByName(tmps); + if (ar == null) + return true; + // TBD "member()" + b = ac.checkRole(user.getId(), ar.getId()); + if (!b) + return false; + } + return true; + } + + public boolean checkReadPermission(Item item, int userid) + { + UserManager userManager = (UserManager) coreManager. + getComponentDirectory().getManager("userManager"); + User user = userManager.getUser(userid); + return checkReadPermission(item, user); + } + + /** + * + */ + public boolean checkUpdatePermission(Item item, User user) + { + UserManager userManager = (UserManager) coreManager. + getComponentDirectory().getManager("userManager"); + // check permission + Map attrs = new HashMap(); + attrs.put("itemid", new Integer(item.getId())); + boolean b = userManager. + checkPermission(user.getId(), "item", "update", attrs); + if (b) return true; + // if not than check rolewrite attribute + String tmps = (String)item.getAttribute("roleupdate"); + if (tmps!=null && tmps.length()>0) { + AccessControl ac = userManager.getAccessControl(); + AccessRole ar = ac.getAccessRoleByName(tmps); + if (ar == null) + return false; + // TBD "member()" + b = ac.checkRole(user.getId(), ar.getId()); + if (b) + return true; + } + return false; + } + + public boolean checkUpdatePermission(Item item, int userid) + { + UserManager userManager = (UserManager) coreManager. + getComponentDirectory().getManager("userManager"); + User user = userManager.getUser(userid); + return checkUpdatePermission(item, user); + } + } Index: itemontology.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/itemontology.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- itemontology.xml 18 Oct 2006 16:47:50 -0000 1.12 +++ itemontology.xml 24 Nov 2006 08:05:56 -0000 1.13 @@ -5,6 +5,12 @@ <attr name="itemid" type="int"/> <attr name="globalid" type="string(64)"/> <attr name="itemclass" type="string(50)"/> +<attr name="roleread" type="string(30)"> + <description lang="de">(Benutzer-)Rolle zum Einschränken der Leseberechtigung</description> +</attr> +<attr name="roleupdate" type="string(30)"> + <description lang="de">(Benutzer-)Rolle zum Erweitern der Updateberechtigung</description> +</attr> <attr name="title" type="string(200)" multilanguage="true"> <description lang="de">Titel</description> </attr> Index: ItemManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManager.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ItemManager.java 22 Sep 2006 17:28:55 -0000 1.32 +++ ItemManager.java 24 Nov 2006 08:05:56 -0000 1.33 @@ -12,9 +12,11 @@ package org.cobricks.item; +import java.util.Collection; import java.util.Date; import java.util.Map; import java.util.List; +import java.util.Set; import org.cobricks.core.CobricksException; import org.cobricks.core.ComponentManagerInterface; @@ -113,9 +115,30 @@ * documentation for details) and returns a List containing the Items * that match this query. */ + List searchItems(String xpath, String sortby, int maxrows); + List searchItems(String xpath); /** + * This method searches for Items by some given attributes + * and returns a List containing the Items that match this query. + */ + List searchItems(Map query, String sortby, int maxrows) + throws CobricksException; + + /** + * This method searches for Items by some given attributes + * and returns a List containing the Items that match this query. + * Only items are returned where the user has the given permission. + */ + List searchItemsByPermission(int userid, String permission, + String title, + List itemclasses, List categories, + String sortby, int maxrows) + throws CobricksException; + + + /** * This method deletes an item from the persistent data bases. */ void deleteItem(int localid) throws CobricksException; @@ -269,7 +292,8 @@ */ List searchItemsByTimestamp(String aname, long avaluelow, long avaluehigh, boolean sortasc, boolean noexpired, - List itemclasses, List categories, + List itemclasses, + List categories, int maxrows) throws CobricksException; @@ -310,5 +334,16 @@ * @return Returns a new versionid of the content if it was created * otherwise -1. */ - int createContentVersion(int itemid, String lang, String content, User creator); + int createContentVersion(int itemid, String lang, String content, + User creator); + + + /** + * + */ + public boolean checkReadPermission(Item item, int userid); + public boolean checkReadPermission(Item item, User user); + public boolean checkUpdatePermission(Item item, int userid); + public boolean checkUpdatePermission(Item item, User user); + } Index: properties.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/properties.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- properties.txt 29 May 2006 05:35:25 -0000 1.16 +++ properties.txt 24 Nov 2006 08:05:56 -0000 1.17 @@ -19,7 +19,7 @@ org.cobricks.item.comp.listento= #item cache -item.cache.maxsize=50 +item.cache.maxsize=5000 # item annotations item.attachments.storage=file Index: ItemAccessHandler.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemAccessHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ItemAccessHandler.java 20 Dec 2005 10:25:30 -0000 1.3 +++ ItemAccessHandler.java 24 Nov 2006 08:05:56 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2005 Cobricks Group. All rights reserved. + * Copyright (c) 2004-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software Index: ItemPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemPresenter.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- ItemPresenter.java 26 Oct 2006 10:38:25 -0000 1.53 +++ ItemPresenter.java 24 Nov 2006 08:05:56 -0000 1.54 @@ -692,15 +692,17 @@ } /** - * This method invokes method "printAttrInput(String itemClass, String aname, - * String lang, String requestVal, int rows, int cols, boolean readonly)" - * using default values for the last three parameters (auto sizing the - * number of rows, default maximum number of columns, no read only field). + * This method invokes method "printAttrInput(String itemClass, + * String aname, String lang, String requestVal, int rows, int cols, + * boolean readonly)" using default values for the last three + * parameters (auto sizing the number of rows, default maximum number + * of columns, no read only field). * @param itemClass The name of the item class of the attribute. * @param aname The name of the attribute. * @param lang The language, needed for data types whose representation * differs for different languages (e.g. "datetime") - * @param requestVal The value the input field shall be initially filled with. + * @param requestVal The value the input field shall be initially + * filled with. * @return The html form input field as String */ public final String printAttrInput(String itemClass, String aname, @@ -728,21 +730,23 @@ /** * This method prints out html form input fields for item class - * attributes. The result can be a text field, radio buttons or a drop down - * menu depending on the parameter values and the data type of the given - * attribute. + * attributes. The result can be a text field, radio buttons or a drop + * down menu depending on the parameter values and the data type of + * the given attribute. * @param itemClass The name of the item class of the attribute. * @param aname The name of the attribute. * @param lang The language, needed for data types whose representation * differs for different languages (e.g. "datetime") - * @param requestVal The value the input field shall be initially filled with. - * @param rows The number of rows for a text input field, if value is -1, the - * size in case of an text input field is determined automatically. For - * an input field type other than text this parameter is ignored. + * @param requestVal The value the input field shall be initially + * filled with. + * @param rows The number of rows for a text input field, if value + * is -1, the size in case of an text input field is determined + * automatically. For an input field type other than text this + * parameter is ignored. * @param cols The width for a text input field. For an input field type - * other than text this parameter is ignored. + * other than text this parameter is ignored. * @param readonly Determines if it shall be possible to change the content - * of this input field. + * of this input field. * @return The html form input field as String */ public final String printAttrInput(String itemClass, String aname, @@ -847,14 +851,16 @@ if (typeName.equals("datetime")) { result += ("<br/>(" - + ((SimpleDateFormat) PortalPresenter.getDateTimeFormatter(lang, true)) - .toLocalizedPattern() + ")"); + + ((SimpleDateFormat) PortalPresenter. + getDateTimeFormatter(lang, true)) + .toLocalizedPattern() + ")"); } if (typeName.equals("date")) { result += ("<br/>(" - + ((SimpleDateFormat) PortalPresenter.getDateTimeFormatter(lang, false)) - .toLocalizedPattern() + ")"); + + ((SimpleDateFormat) PortalPresenter. + getDateTimeFormatter(lang, false)) + .toLocalizedPattern() + ")"); } } else { result += ("<textarea name=\"" + aname + "\""); @@ -866,11 +872,12 @@ result += ">"; + String tmps = defaultVal; if ((requestVal != null) && (requestVal.toString().length() > 0)) { - result += requestVal.toString(); - } else if (defaultVal != null) { - result += defaultVal; + tmps = requestVal.toString(); } + if (tmps != null) + result += (tmps.replaceAll("&", "&")); result += "</textarea>"; } @@ -1619,36 +1626,10 @@ } } - List itemids = itemManager.searchItems(xpath.toString()); - if (sortby!=null && sortby.length()>0) { - if (sortby.equals("title") || sortby.equals("title_de")) { - itemids = itemManager. - sortItemsByAttribute(itemids,"title_de"); - } - if (sortby.equals("author")) { - itemids = itemManager. - sortItemsByAttribute(itemids,"author"); - } - if (sortby.equals("creationtime")) { - itemids = itemManager. - sortItemsByAttribute(itemids,"creationtime"); - } - if (sortby.equals("updatetime")) { - itemids = itemManager. - sortItemsByAttribute(itemids,"updatetime"); - } - } + List itemids = itemManager. + searchItems(xpath.toString(), sortby, maxrows); - List results = new ArrayList(); - if (maxrows>0 && maxrows<itemids.size()){ - ListIterator li = itemids.listIterator(); - for (int j=0;j<maxrows;j++) { - results.add(li.next()); - } - } else { - results = itemids; - } - return results; + return itemids; } catch (Exception e) { logger.error(LogUtil.ex("failed", e)); @@ -1862,5 +1843,41 @@ } catch (Exception e) { } return itemManager.getContentVersion(iitemid, lang, iversionid); } + + + /** + * + */ + public String checkReadPermission(Item item, int userid) + { + if (itemManager.checkReadPermission(item, userid)) + return "true"; + else + return "false"; + } + + public String checkReadPermission(Item item, User user) + { + if (itemManager.checkReadPermission(item, user)) + return "true"; + else + return "false"; + } + + public String checkUpdatePermission(Item item, int userid) + { + if (itemManager.checkUpdatePermission(item, userid)) + return "true"; + else + return "false"; + } + + public String checkUpdatePermission(Item item, User user) + { + if (itemManager.checkUpdatePermission(item, user)) + return "true"; + else + return "false"; + } } Index: ItemServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemServlet.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- ItemServlet.java 5 Oct 2006 17:57:50 -0000 1.45 +++ ItemServlet.java 24 Nov 2006 08:05:56 -0000 1.46 @@ -316,19 +316,6 @@ String itemid = prequest.getRequestParameter("itemid"); logger.debug("performUpdate("+itemid+")"); - // check access rights - PortalUser portalUser = prequest.getPortalUser(); - Map attrs = new HashMap(); - attrs.put("itemid", itemid); - /* - if (!userManager.getAccessControl(). - checkPermission(portalUser.getUserId(), "item", - "update", attrs)) { - prequest.setReturnCode(2000); - return "noaccess"; - } - */ - Item item = null; try { item = itemManager.getItem(Integer.parseInt(itemid)); @@ -347,6 +334,16 @@ return "error"; } + // check access rights + PortalUser portalUser = prequest.getPortalUser(); + /* + if (!itemManager. + checkUpdatePermission(item, portalUser.getUserId())) { + prequest.setReturnCode(2000); + return "noaccess"; + } + */ + // check if there are uploaded files and store them in // attributes or in the context String tmps = prequest.getRequestParameter("uploadfileattrs"); |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:35
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/course In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/course Modified Files: CourseDate.java CourseManager.java CourseManagerImpl.java CourseModule.java CourseModuleProgramRel.java CoursePresenter.java CourseServlet.java Log Message: Index: CoursePresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CoursePresenter.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- CoursePresenter.java 18 Oct 2006 16:47:50 -0000 1.23 +++ CoursePresenter.java 24 Nov 2006 08:05:56 -0000 1.24 @@ -294,9 +294,11 @@ { logger.debug("Search Course Rooms : "+query); try { - return courseManager.searchRooms(parseQuery(query)); + Map m = parseQuery(query); + m.put("crhidden", new Integer(1)); + return courseManager.searchRooms(m); } catch (Exception e) { - logger.error(LogUtil.ex("Failed searching courserooms.", e)); + logger.error(LogUtil.ex("Failed searching course rooms.", e)); } return null; } @@ -563,21 +565,21 @@ return sb.toString(); } - public String printPrerequ(CourseModule cm) + public String printPrerequ(CourseModule cm, String lang) { String tmps = cm.getPrerequ(); - return printPrerequ(tmps); + return printPrerequ(tmps, lang); } - public String printPrerequ(Course c) + public String printPrerequ(Course c, String lang) { String tmps = c.getPrerequ(); if (tmps==null || tmps.length()<1) tmps = c.getCourseModule().getPrerequ(); - return printPrerequ(tmps); + return printPrerequ(tmps, lang); } - public String printPrerequ(String tmps) + public String printPrerequ(String tmps, String lang) { StringBuffer sb = new StringBuffer(""); // parse prerequ as XML document @@ -608,6 +610,9 @@ sb.append(" (").append(tmps2).append(")"); } else { String tmps2 = ((Element)node).getAttribute("kommentar"); + if (lang.equals("en")) { + tmps2 = ((Element)node).getAttribute("comment"); + } if (tmps2!=null && tmps2.length()>0) sb.append(tmps2); } Index: CourseServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseServlet.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- CourseServlet.java 18 Oct 2006 16:47:50 -0000 1.23 +++ CourseServlet.java 24 Nov 2006 08:05:56 -0000 1.24 @@ -451,6 +451,7 @@ attrs.put("cmname", prequest.getRequestParameter("cmname")); attrs.put("cmname_en", prequest.getRequestParameter("cmname_en")); attrs.put("cmshortname", prequest.getRequestParameter("cmshortname")); + attrs.put("cmshortname2", prequest.getRequestParameter("cmshortname2")); attrs.put("cmtype", prequest.getRequestParameter("cmtype")); tmps = prequest.getRequestParameter("cmectscredits"); if (tmps != null) { @@ -569,6 +570,10 @@ if (tmps != null) { attrs.put("cpcomment"+i, tmps); } + tmps = prequest.getRequestParameter("cpcomment_en"+i); + if (tmps != null) { + attrs.put("cpcomment_en"+i, tmps); + } } return attrs; } Index: CourseModuleProgramRel.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseModuleProgramRel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CourseModuleProgramRel.java 30 May 2006 14:32:00 -0000 1.2 +++ CourseModuleProgramRel.java 24 Nov 2006 08:05:56 -0000 1.3 @@ -34,6 +34,7 @@ int cpstartsem; int cpendsem; String cpcomment; + String cpcomment_en; CourseModule cm; CourseProgram cp; @@ -66,6 +67,11 @@ return cpcomment; } + public String getCommentEn() + { + return cpcomment_en; + } + public int getStartSem() { return cpstartsem; @@ -123,6 +129,7 @@ } catch (Exception e) { } cptype = (String)map.get("cptype"); cpcomment = (String)map.get("cpcomment"); + cpcomment_en = (String)map.get("cpcomment_en"); } } Index: CourseManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManager.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- CourseManager.java 18 Oct 2006 16:47:50 -0000 1.31 +++ CourseManager.java 24 Nov 2006 08:05:56 -0000 1.32 @@ -520,5 +520,3 @@ public int getLecturerIdByName(String lname); } - - Index: CourseManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManagerImpl.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- CourseManagerImpl.java 18 Oct 2006 16:47:50 -0000 1.57 +++ CourseManagerImpl.java 24 Nov 2006 08:05:56 -0000 1.58 @@ -547,10 +547,13 @@ where += "AND course.cid = '"+attrs.get("cid")+"' "; if (attrs.get("cmid")!=null) where += "AND course.cmid = '"+attrs.get("cmid")+"' "; - if (attrs.get("cname")!=null) + if (attrs.get("cname")!=null) { where = where + "AND (cname like '%"+attrs.get("cname")+"%' OR " - +"cname_en like '%"+attrs.get("cname")+"%')" ; + +"cname_en like '%"+attrs.get("cname")+"%' OR " + +"cmname like '%"+attrs.get("cname")+"%' OR " + +"cmname_en like '%"+attrs.get("cname")+"%')" ; + } if (attrs.get("cname_en")!=null) where += "AND cname_en like '%"+attrs.get("cname_en")+"%' "; if(attrs.get("cmtype")!=null) @@ -805,6 +808,7 @@ copyAttr("cmname_en", attrs, sqlAttrs); copyAttr("cmsid", attrs, sqlAttrs); copyAttr("cmshortname", attrs, sqlAttrs); + copyAttr("cmshortname2", attrs, sqlAttrs); copyAttr("cmtype", attrs, sqlAttrs); copyAttr("cmectscredits", attrs, sqlAttrs); copyAttr("cmcontent", attrs, sqlAttrs); @@ -856,6 +860,8 @@ if (o != null) sqlAttrs2.put("cptype", o); o = attrs.get("cpcomment"+i); if (o != null) sqlAttrs2.put("cpcomment", o); + o = attrs.get("cpcomment_en"+i); + if (o != null) sqlAttrs2.put("cpcomment_en", o); dbAccess.sqlInsert("course_progrel", sqlAttrs2); } } @@ -882,6 +888,7 @@ copyAttr("cmname_en", attrs, sqlAttrs); copyAttr("cmsid", attrs, sqlAttrs); copyAttr("cmshortname", attrs, sqlAttrs); + copyAttr("cmshortname2", attrs, sqlAttrs); copyAttr("cmtype", attrs, sqlAttrs); copyAttr("cmectscredits", attrs, sqlAttrs); copyAttr("cmcontent", attrs, sqlAttrs); @@ -931,6 +938,8 @@ if (o != null) sqlAttrs2.put("cptype", o); o = attrs.get("cpcomment"+i); if (o != null) sqlAttrs2.put("cpcomment", o); + o = attrs.get("cpcomment_en"+i); + if (o != null) sqlAttrs2.put("cpcomment_en", o); dbAccess.sqlInsert("course_progrel", sqlAttrs2); } } @@ -1081,6 +1090,8 @@ where += "AND cmsid like '%"+attrs.get("cmsid")+"%' "; if (attrs.get("cmshortname")!=null) where += "AND cmshortname like '%"+attrs.get("cmshortname")+"%' "; + if (attrs.get("cmshortname2")!=null) + where += "AND cmshortname2 like '%"+attrs.get("cmshortname2")+"%' "; if (attrs.get("cmtype")!=null) where += "AND cmtype = '"+attrs.get("cmtype")+"' "; if (attrs.get("cmhidden")!=null) @@ -1247,18 +1258,17 @@ throws CobricksException { // display all courserooms by default - logger.debug("Search Courserooms"); + logger.debug("search course rooms"); List result = new ArrayList(); - String sql = "SELECT * FROM course_room ORDER BY crid"; + String sql = "SELECT * FROM course_room ORDER BY crname"; if (attrs.size()>0){ String where = "where crid = crid "; if (attrs.get("crname")!=null) where += "AND crname like '%"+attrs.get("crname")+"%' "; if (attrs.get("crid")!=null) where += "AND crid = "+attrs.get("crid")+" "; - sql = "SELECT * FROM course_room "+where+" ORDER BY crid"; + sql = "SELECT * FROM course_room "+where+" ORDER BY crname"; } -// logger.debug("Search Courserooms : ("+sql+")"); List sqlList = dbAccess.sqlQuery(sql); ListIterator i = sqlList.listIterator(); while (i.hasNext()) { @@ -1344,7 +1354,9 @@ /** * @see org.cobricks.course.LecturerManager#getLecturer(int) */ - public CourseLecturer getLecturer(int lid) throws CobricksException { + public CourseLecturer getLecturer(int lid) + throws CobricksException + { CourseLecturer result = (CourseLecturer)courseLecturerCache.get(new Integer(lid)); if (result != null) { @@ -1361,12 +1373,14 @@ } return result; } + public CourseLecturer getLecturerForExtId(String lextid) { - Map dbres = dbAccess.sqlQuerySingleRow("select * from course_lecturer " + - "where lextid = '"+lextid+"'"); - if(dbres.isEmpty()) return null; - else{ + Map dbres = dbAccess. + sqlQuerySingleRow("select * from course_lecturer " + +"where lextid = '"+lextid+"'"); + if (dbres.isEmpty()) return null; + else { CourseLecturer result = new CourseLecturer(); result.loadFromMap(dbres, this); int lid = result.getId(); @@ -1380,7 +1394,9 @@ /** * @see org.cobricks.course.LecturerManager#getLecturerAsXML(int) */ - public String getLecturerAsXML(int lid) throws CobricksException { + public String getLecturerAsXML(int lid) + throws CobricksException + { CourseLecturer lecturer = getLecturer(lid); if (lecturer != null) return lecturer.toXML(); @@ -1453,7 +1469,8 @@ * @see org.cobricks.course.ProgramManager#updateProgram(int, java.util.Map, org.cobricks.user.User) */ public void updateProgram(int cpid, Map attrs, User user) - throws CobricksException { + throws CobricksException + { // copy attributes Map sqlAttrs = new HashMap(); copyAttr("cpname", attrs, sqlAttrs); @@ -1512,7 +1529,9 @@ /** * @see org.cobricks.course.ProgramManager#getProgramAsXML(int) */ - public String getProgramAsXML(int cpid) throws CobricksException { + public String getProgramAsXML(int cpid) + throws CobricksException + { CourseProgram program = getProgram(cpid); if (program != null) return program.toXML(); @@ -1619,7 +1638,8 @@ date.before(tmpCourseDate.getEndDate())) { CalendarEntry calEntry = new CalendarEntry(); calEntry.setName(tmpCourse.getFullName()); - calEntry.setUrl("c.html?cid="+tmpCourse.getId()+" "); + calEntry.setUrl("/course/c.html?cid=" + +tmpCourse.getId()+" "); calEntry.setStarthour(tmpCourseDate.getStartHour()); calEntry.setStartmin(tmpCourseDate.getStartMin()); calEntry.setEndhour(tmpCourseDate.getEndHour()); @@ -1701,7 +1721,9 @@ /** * @see org.cobricks.course.CourseManager#getCoursesForLecturer(int) */ - public List getCoursesForLecturer(int lid) throws CobricksException { + public List getCoursesForLecturer(int lid) + throws CobricksException + { logger.debug("getCoursesForLecturer for lecturer id ("+lid+")..."); String sql = "select cid from course_lecturerrel " +"where lid = "+lid; @@ -1726,7 +1748,8 @@ /** * @see org.cobricks.course.CourseManager#getLecturersForCourse(int) */ - public List getLecturersForCourse(int cid){ + public List getLecturersForCourse(int cid) + { logger.debug("getLecturersForCourse("+cid+")"); String sql = "select lid from course_lecturerrel " +"where cid = "+cid; @@ -1775,6 +1798,8 @@ int cpid = id2.intValue(); if (attrs.get("cpcomment") == null) attrs.put("cpcomment", ""); + if (attrs.get("cpcomment_en") == null) + attrs.put("cpcomment_en", ""); dbAccess.sqlExecute("delete from course_progrel " + "where cmid = "+cmid+" and cpid = "+cpid); dbAccess.sqlInsert("course_progrel", attrs); Index: CourseDate.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseDate.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CourseDate.java 6 Feb 2005 15:52:26 -0000 1.8 +++ CourseDate.java 24 Nov 2006 08:05:56 -0000 1.9 @@ -1,5 +1,5 @@ - /* - * Copyright (c) 2004 Cobricks Group. All rights reserved. +/* + * Copyright (c) 2004-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -14,17 +14,19 @@ import java.util.*; -import org.apache.log4j.*; +import org.apache.log4j.Logger; /** * A class which represents a single date where a course takes place. It also * holds the relation of the course to the room. + * * @author mic...@ac... * @version $Date$ */ -public class CourseDate extends org.cobricks.core.DataObject implements java.io.Serializable +public class CourseDate extends org.cobricks.core.DataObject + implements java.io.Serializable { static Logger logger = Logger.getLogger(CourseDate.class); Index: CourseModule.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseModule.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CourseModule.java 11 Jul 2006 10:27:03 -0000 1.3 +++ CourseModule.java 24 Nov 2006 08:05:56 -0000 1.4 @@ -66,16 +66,37 @@ return (String)attrs.get("cmshortname"); } + public String getShortName2() + { + return (String)attrs.get("cmshortname2"); + } + public String getName() { - return (String)attrs.get("cmname"); + return getName(false); + } + + public String getName(boolean addsid) + { + String tmps = (String)attrs.get("cmname"); + if (addsid == false) + return tmps; + return tmps + " (" + getSId() + ")"; } public String getName(String lang) { + return getName(lang, false); + } + + public String getName(String lang, boolean addsid) + { + String tmps = (String)attrs.get("cmname"); if (lang.equals("en")) - return (String)attrs.get("cmname_en"); - return (String)attrs.get("cmname"); + tmps = (String)attrs.get("cmname_en"); + if (addsid == false) + return tmps; + return tmps + " (" + getSId() + ")"; } public String getType() |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:35
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/portal Modified Files: CalendarPresenter.java InitServlet.java PortalPresenter.java PortalRequest.java PortalServletAdaptor.java properties.txt Log Message: Index: properties.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/properties.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- properties.txt 18 Oct 2006 16:47:50 -0000 1.13 +++ properties.txt 24 Nov 2006 08:05:57 -0000 1.14 @@ -70,8 +70,8 @@ portal.presenter.timestyle=HH:mm #pageheader and pagefooter for Wiki pages -portal.pageheaderwiki=$portalPresenter.parse("$contextPath/pageheaderwiki.html", $portalRequest) -portal.pagefooterwiki=$portalPresenter.parse("$contextPath/pagefooterwiki.html", $portalRequest) +portal.pageheaderwiki=$portalPresenter.parse("/pageheaderwiki.html", $portalRequest) +portal.pagefooterwiki=$portalPresenter.parse("/pagefooterwiki.html", $portalRequest) # portal.linkabbreviations=wikipedia;google Index: PortalPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalPresenter.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- PortalPresenter.java 23 Nov 2006 17:44:15 -0000 1.52 +++ PortalPresenter.java 24 Nov 2006 08:05:57 -0000 1.53 @@ -198,8 +198,7 @@ logger.debug("parse("+filename+")"); String pageContent = portalManager.getPageContent(filename, portalRequest); - try { - + try { StringWriter sw = new StringWriter(); Velocity.evaluate(portalRequest.getVelocityContext(), sw, "", pageContent); @@ -1170,7 +1169,18 @@ */ public final String escapeHTML(String s) { - return s.replaceAll("&", "&"); + String tmps = s.replaceAll("&", "&"); + tmps = tmps.replaceAll("<", "<"); + tmps = tmps.replaceAll(">", ">"); + return tmps; + } + + public final String escapeXML(String s) + { + String tmps = s.replaceAll("&", "&"); // oder <![CDATA[&]]⥠+ tmps = tmps.replaceAll("<", "<"); + tmps = tmps.replaceAll(">", ">"); + return tmps; } } Index: CalendarPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/CalendarPresenter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CalendarPresenter.java 26 Oct 2006 10:38:25 -0000 1.6 +++ CalendarPresenter.java 24 Nov 2006 08:05:57 -0000 1.7 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Cobricks Group. All rights reserved. + * Copyright (c) 2004-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -16,7 +16,7 @@ import java.text.SimpleDateFormat; import java.util.*; -import org.apache.log4j.*; +import org.apache.log4j.Logger; import org.cobricks.core.ComponentDirectory; import org.cobricks.core.ComponentManagerInterface; @@ -83,9 +83,7 @@ public String printSmallMonthCalendarAsHtml(String datestring, String catids, String lang, - String daytemplate, - String weektemplate, - String monthtemplate) + String template) { if (lang == null || lang.length()<1) lang = "en"; if (catids == null) catids = ""; @@ -115,19 +113,13 @@ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // extend template names - if (daytemplate == null) daytemplate = "cal-day.html"; - String newdaytemplate = daytemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newweektemplate = weektemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newmonthtemplate = monthtemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - daytemplate = newdaytemplate; - weektemplate = newweektemplate; - monthtemplate = newmonthtemplate; + if (template == null) template = "calendar.html"; + String daytemplate = template + +"?caltype=day&lang="+lang+"&catids="+catids+"&datestring="; + String weektemplate = template + +"?caltype=week&lang="+lang+"&catids="+catids+"&datestring="; + String monthtemplate = template + +"?caltype=month&lang="+lang+"&catids="+catids+"&datestring="; // and now draw the calendar ... StringBuffer sb = new StringBuffer(""); @@ -248,21 +240,18 @@ } - public String printMonthCalendarAsHtml(String datestring, String catids, - String lang, - String daytemplate, - String weektemplate, - String monthtemplate) + public String printMonthCalendarAsHtml(String datestring, + String catids, + String lang, + String template) { return printMonthCalendarAsHtml(datestring, catids, - lang,daytemplate,weektemplate,monthtemplate,"0"); + lang,template,"0"); } public String printMonthCalendarAsHtml(String datestring, String catids, String lang, - String daytemplate, - String weektemplate, - String monthtemplate, + String template, String userId) { if (lang == null || lang.length()<1) lang = "en"; @@ -293,19 +282,13 @@ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // extend template names - if (daytemplate == null) daytemplate = "cal-day.html"; - String newdaytemplate = daytemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newweektemplate = weektemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newmonthtemplate = monthtemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - daytemplate = newdaytemplate; - weektemplate = newweektemplate; - monthtemplate = newmonthtemplate; + if (template == null) template = "calendar.html"; + String daytemplate = template + +"?caltype=day&lang="+lang+"&catids="+catids+"&datestring="; + String weektemplate = template + +"?caltype=week&lang="+lang+"&catids="+catids+"&datestring="; + String monthtemplate = template + +"?caltype=month&lang="+lang+"&catids="+catids+"&datestring="; // and now draw the calendar ... StringBuffer sb = new StringBuffer(""); @@ -416,20 +399,16 @@ public String printWeekCalendarAsHtml(String datestring, String catids, - String lang, - String daytemplate, - String weektemplate, - String monthtemplate) + String lang, + String template) { return printWeekCalendarAsHtml(datestring, catids, - lang,daytemplate,weektemplate,monthtemplate,"0"); + lang, template, "0"); } public String printWeekCalendarAsHtml(String datestring, String catids, String lang, - String daytemplate, - String weektemplate, - String monthtemplate, + String template, String userId) { if (lang == null || lang.length()<1) lang = "en"; @@ -461,27 +440,19 @@ sb.append("<td valign=\"top\">"); sb.append(this.printSmallMonthCalendarAsHtml(datestring, catids, lang, - weektemplate, - weektemplate, - monthtemplate)); + template)); sb.append("</td>"); sb.append("<td valign=\"top\">"); // extend template names - if (daytemplate == null) daytemplate = "cal-day.html"; - String newdaytemplate = daytemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newweektemplate = weektemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newmonthtemplate = monthtemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - daytemplate = newdaytemplate; - weektemplate = newweektemplate; - monthtemplate = newmonthtemplate; + if (template == null) template = "calendar.html"; + String daytemplate = template + +"?caltype=day&lang="+lang+"&catids="+catids+"&datestring="; + String weektemplate = template + +"?caltype=week&lang="+lang+"&catids="+catids+"&datestring="; + String monthtemplate = template + +"?caltype=month&lang="+lang+"&catids="+catids+"&datestring="; sb.append("<table border=\"0\" width=\"450\">"); sb.append("<tr bgcolor=\"#dddddd\">"); @@ -541,20 +512,16 @@ */ public String printDayCalendarAsHtml(String datestring, String catids, String lang, - String daytemplate, - String weektemplate, - String monthtemplate) + String template) { - return printDayCalendarAsHtml(datestring, catids, - lang,daytemplate,weektemplate,monthtemplate,"0"); + return printDayCalendarAsHtml(datestring, catids, lang, + template, "0"); } public String printDayCalendarAsHtml(String datestring, String catids, - String lang, - String daytemplate, - String weektemplate, - String monthtemplate, - String userId) + String lang, + String template, + String userId) { if (lang == null || lang.length()<1) lang = "en"; if (catids == null) catids = ""; @@ -579,24 +546,17 @@ sb.append("<table border=\"0\"><tr><td valign=\"top\">"); sb.append(this.printSmallMonthCalendarAsHtml(datestring, catids, lang, - daytemplate, weektemplate, - monthtemplate)); + template)); sb.append("</td><td valign=\"top\">"); // extend template names - if (daytemplate == null) daytemplate = "cal-day.html"; - String newdaytemplate = daytemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newweektemplate = weektemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - String newmonthtemplate = monthtemplate + - ("?lang="+lang+"&dt="+daytemplate+"&wt="+weektemplate - +"&mt="+monthtemplate+"&catids="+catids+"&datestring="); - daytemplate = newdaytemplate; - weektemplate = newweektemplate; - monthtemplate = newmonthtemplate; + if (template == null) template = "calendar.html"; + String daytemplate = template + +"?caltype=day&lang="+lang+"&catids="+catids+"&datestring="; + String weektemplate = template + +"?caltype=week&lang="+lang+"&catids="+catids+"&datestring="; + String monthtemplate = template + +"?caltype=month&lang="+lang+"&catids="+catids+"&datestring="; sb.append("<table border=\"0\" width=\"450\">"); sb.append("<tr bgcolor=\"#dddddd\"><td colspan=\"2\" "). @@ -638,7 +598,8 @@ return sb.toString(); } - private String getEventsForDay(String format,Calendar cal, String userID){ + private String getEventsForDay(String format,Calendar cal, String userID) + { List calendarEntries = new ArrayList(); CalendarEntry calEntry = null; StringBuffer sb = new StringBuffer(""); Index: InitServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/InitServlet.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- InitServlet.java 26 Oct 2006 10:38:25 -0000 1.13 +++ InitServlet.java 24 Nov 2006 08:05:57 -0000 1.14 @@ -106,7 +106,17 @@ return; } + // initialize all the other components + // this call instantiates all manager and presenter objects + try { + coreManager.initComponents(properties); + } catch (Throwable e) { + logger.error(LogUtil.ex("Failed initializing components.", e)); + } + // initialize Velocity + PortalResourceLoader.setConfigDir(configDir); + PortalResourceLoader.setWebspaceDir(webspaceDir); try { // load Velocity properties Properties velocityProperties = new Properties(); @@ -128,14 +138,6 @@ logger.error(LogUtil.exception("Failed initializing Velocity", e)); } - // initialize all the other components - // this call instantiates all manager and presenter objects - try { - coreManager.initComponents(properties); - } catch (Throwable e) { - logger.error(LogUtil.ex("Failed initializing components.", e)); - } - // finish initialization of Velocity PortalResourceLoader ComponentDirectory cd = coreManager.getComponentDirectory(); if (cd != null) Index: PortalRequest.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalRequest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- PortalRequest.java 13 Nov 2006 16:59:18 -0000 1.22 +++ PortalRequest.java 24 Nov 2006 08:05:57 -0000 1.23 @@ -91,8 +91,8 @@ velocityContext.put("sessionId", session.getId()); if (portalUser != null) { velocityContext.put("portalUser", portalUser); - velocityContext.put("userId", Integer. - toString(portalUser.getUserId())); + velocityContext.put("userId", + new Integer(portalUser.getUserId())); String userlogin = portalUser.getUserLogin(); if (userlogin == null) userlogin = PortalUser.ANONYMOUS_USERLOGIN; @@ -101,7 +101,7 @@ session.setAttribute("userId", new Integer(portalUser.getUserId())); } else { - velocityContext.put("userId", "0"); + velocityContext.put("userId", new Integer(0)); velocityContext.put("userLogin", PortalUser.ANONYMOUS_USERLOGIN); } @@ -122,19 +122,21 @@ // check if context has user information set if (portalUser != null) { velocityContext.put("portalUser", portalUser); - velocityContext.put("userId", Integer. - toString(portalUser.getUserId())); + velocityContext.put("userId", + new Integer(portalUser.getUserId())); String userlogin = portalUser.getUserLogin(); if (userlogin == null) userlogin = PortalUser.ANONYMOUS_USERLOGIN; velocityContext.put("userLogin", userlogin); } else { - velocityContext.put("userId", "0"); + velocityContext.put("userId", new Integer(0)); velocityContext.put("userLogin", PortalUser.ANONYMOUS_USERLOGIN); } } + // and now the request specific Velocity context + velocityContext = new VelocityContext(velocityContext); velocityContext.put("lang", lang); velocityContext.put("pageLang", pageLang); velocityContext.put("pitemid", ""); @@ -143,6 +145,7 @@ velocityContext.put("velocityContext", velocityContext); velocityContext.put("returnCmd", returnCmd); velocityContext.put("returnCode", new Integer(returnCode)); + // add request properties Map requestParameters = request.getParameterMap(); Iterator iter = requestParameters.keySet().iterator(); @@ -330,10 +333,12 @@ public String getBaseUrl() { String url = getHttpServletRequest().getRequestURL().toString(); + if (url == null) return ""; int pos = url.indexOf("//"); pos = url.indexOf("/", pos+2); url = url.substring(0, pos); - url += getHttpServletRequest().getContextPath(); + if (request == null) return ""; + url += request.getContextPath(); url += pagePath; return url; } Index: PortalServletAdaptor.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalServletAdaptor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- PortalServletAdaptor.java 5 Oct 2006 15:07:45 -0000 1.23 +++ PortalServletAdaptor.java 24 Nov 2006 08:05:57 -0000 1.24 @@ -192,6 +192,15 @@ } return; } + + // set the character encoding + String tmps = request.getCharacterEncoding(); + if (tmps == null) { + logger.debug("encoding of request is NULL, setting to UTF-8"); + request.setCharacterEncoding("UTF-8"); + } else { + logger.debug("encoding of request is "+tmps); + } StringWriter responseStringWriter = new StringWriter(); PrintWriter out = new PrintWriter(responseStringWriter); @@ -327,13 +336,13 @@ String pname = portalRequest.getPageName(); if (pname == null) pname = ""; if (pname.endsWith("xml")) - response.setContentType("text/xml"); + response.setContentType("text/xml;charset=utf-8"); else if (pname.endsWith("css")) - response.setContentType("text/css"); + response.setContentType("text/css;charset=utf-8"); else if (pname.endsWith("vcf")) - response.setContentType("text/x-vcard"); + response.setContentType("text/x-vcard;charset=utf-8"); else - response.setContentType("text/html"); + response.setContentType("text/html;charset=utf-8"); try { // get the writer object |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:35
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/velocity In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/portal/velocity Modified Files: PortalResourceLoader.java Log Message: Index: PortalResourceLoader.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/velocity/PortalResourceLoader.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- PortalResourceLoader.java 10 Feb 2006 11:36:15 -0000 1.7 +++ PortalResourceLoader.java 24 Nov 2006 08:05:57 -0000 1.8 @@ -48,7 +48,9 @@ CoreManager coreManager = null; public static PortalManager portalManager = null; - + public static String configDir = null; + public static String webspaceDir = null; + public void init(ExtendedProperties configuration) { @@ -62,6 +64,16 @@ PortalResourceLoader.portalManager = portalManager; } + static public void setConfigDir(String configDir) + { + PortalResourceLoader.configDir = configDir; + } + + static public void setWebspaceDir(String webspaceDir) + { + PortalResourceLoader.webspaceDir = webspaceDir; + } + /** * Get an InputStream so that the Runtime can build a @@ -79,6 +91,7 @@ // check if the resource can be found via the Portal Manager String content = null; if (portalManager != null) { + String pagePath = "/"; String pageName = templateName; int pos = pageName.lastIndexOf(File.separator); @@ -87,6 +100,15 @@ pageName = pageName.substring(pos+1); } PortalObject page = portalManager.getObject(pagePath, pageName); + if (page == null) { + pagePath = "/WEB-INF/conf/"; + pageName = templateName; + if (pos>-1) { + pagePath = pageName.substring(0, pos+1); + pageName = pageName.substring(pos+1); + } + page = portalManager.getObject(pagePath, pageName); + } if (page != null) { if (page instanceof PortalPage) { Map pc = ((PortalPage)page).getStringPageContent(null); @@ -94,14 +116,35 @@ content = (String)pc.get(pageLang); } } + + if (content != null) { + InputStream inputStream = + new ByteArrayInputStream(content.getBytes()); + if (inputStream != null) { + return inputStream; + } + } + + } else { + + // check if the resource can be found in the + // config directory (if PortalManager is not initialized) + try { + File file = new File(configDir+File.separator+templateName); + InputStream is = new FileInputStream(file); + if (is != null) return is; + } catch(Exception e) { } + + // check if the resource can be found in the + // webspace directory (if PortalManager is not initialized) + try { + File file = new File(webspaceDir+File.separator+templateName); + InputStream is = new FileInputStream(file); + if (is != null) return is; + } catch(Exception e) { } + } - if (content != null) { - InputStream inputStream = - new ByteArrayInputStream(content.getBytes()); - if (inputStream != null) { - return inputStream; - } - } + // check if the resource can be found in the // package org.cobricks.portal.velocity try { |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:34
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item/db In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/item/db Modified Files: item.xml Log Message: Index: item.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/db/item.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- item.xml 29 May 2006 09:14:26 -0000 1.3 +++ item.xml 24 Nov 2006 08:05:57 -0000 1.4 @@ -13,6 +13,8 @@ <column name="state" type="int"/> <column name="origin" type="varchar(20)"/> <column name="expirationtime" type="timestamp"/> + <column name="roleread" type="varchar(30)"/> + <column name="roleupdate" type="varchar(30)"/> <index name="item_itemid" unique="true"> <colname>itemid</colname> |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:30
|
Update of /cvsroot/cobricks/cobricks2 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375 Modified Files: build.xml changelog.txt Log Message: Index: changelog.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/changelog.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- changelog.txt 11 Jul 2006 10:27:02 -0000 1.11 +++ changelog.txt 24 Nov 2006 08:05:56 -0000 1.12 @@ -1,3 +1,13 @@ +Cobricks2 v0.38 + +- added file extension swf to mime type heuristics in PortalObject + +- corrected some errors in item search code (for complex queries) + +- corrected errors in context component + +- added support for Geo functions + Cobricks2 v0.37 - forgot password dialog fixed Index: build.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/build.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- build.xml 3 Nov 2006 07:22:55 -0000 1.57 +++ build.xml 24 Nov 2006 08:05:56 -0000 1.58 @@ -249,6 +249,7 @@ <fileset dir="${build.home}/webapps/${webappname}/WEB-INF/classes" includes="org/cobricks/discussion/**" /> </jar> + <copy file="${distbin}/web/WEB-INF/lib/cobricks.jar" tofile="${dist.home}/cobricks.jar" overwrite="true" /> <jar jarfile="${distbin}/web/WEB-INF/lib/cobricksCwall.jar"> <fileset dir="${build.home}/webapps/${webappname}/WEB-INF/classes" @@ -264,7 +265,34 @@ <fileset dir="${build.home}/webapps/ROOT" includes="*/**" /> </jar> - <copy file="${basedir}/conf/localproperties.txt" tofile="${build.home}/webapps/ROOT/WEB-INF/conf/localproperties.txt" overwrite="true" /> + <copy file="${basedir}/conf/localproperties.txt" + tofile="${build.home}/webapps/ROOT/WEB-INF/conf/localproperties.txt" + overwrite="true" failonerror="false" /> + <copy file="${web.home}/WEB-INF/conf/localproperties.txt" + tofile="${dist.home}/mm/conf/localproperties.txt" + overwrite="true" failonerror="false" /> + + <!-- Create JAR file for webspace --> + <jar destfile="${dist.home}/webapp.jar" + basedir="${build.home}/webapps/${webappname}"> + <include name="item/**" /> + <include name="user/**" /> + <include name="portal/**" /> + <include name="course/**" /> + <include name="ADMIN/**" /> + <include name="notfound.html.de" /> + <include name="noaccess.html.de" /> + <include name="noaccess-expired.html.de" /> + <include name="notfound.html.en" /> + <include name="noaccess.html.en" /> + <include name="noaccess-expired.html.en" /> + <include name="pageheader.html.de" /> + <include name="pageheader.html.en" /> + <include name="pagefooter.html.de" /> + <include name="pagefooter.html.en" /> + <include name="navigation.html.de" /> + <include name="navigation.html.en" /> + </jar> </target> |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:30
|
Update of /cvsroot/cobricks/cobricks2/docs In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/docs Modified Files: Category_doc.html Course_doc.html Env_doc.html Item_Search.html LogBrowser.html Main_Page.html Message_doc.html Portal_doc.html Projects.html User_doc.html index.html Log Message: Index: Course_doc.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/Course_doc.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Course_doc.html 10 Feb 2006 12:00:02 -0000 1.7 +++ Course_doc.html 24 Nov 2006 08:05:56 -0000 1.8 @@ -46,11 +46,12 @@ <p><a href="Course_doc.html#GUI_and_Functionality">2.2 GUI and Functionality</a><br /> </p> <div class="tocindent"> -<p><a href="Course_doc.html#View_course">2.2.1 View course</a><br /> -<a href="Course_doc.html#Create_course">2.2.2 Create course</a><br /> -<a href="Course_doc.html#Update_course">2.2.3 Update course</a><br /> -<a href="Course_doc.html#Delete_course">2.2.4 Delete course</a><br /> -<a href="Course_doc.html#Search_courses">2.2.5 Search courses</a><br /> +<p><a href="Course_doc.html#UI_cmds_.28in_CourseServlet.29">2.2.1 UI cmds (in CourseServlet)</a><br /> +<a href="Course_doc.html#View_course">2.2.2 View course</a><br /> +<a href="Course_doc.html#Create_course">2.2.3 Create course</a><br /> +<a href="Course_doc.html#Update_course">2.2.4 Update course</a><br /> +<a href="Course_doc.html#Delete_course">2.2.5 Delete course</a><br /> +<a href="Course_doc.html#Search_courses">2.2.6 Search courses</a><br /> </p> </div> <p><a href="Course_doc.html#Access_Control">2.3 Access Control</a><br /> @@ -430,6 +431,33 @@ </pre> <a name="CourseAccessHandler"></a><h4>CourseAccessHandler</h4> <a name="GUI_and_Functionality"></a><h3> GUI and Functionality </h3> +<a name="UI_cmds_.28in_CourseServlet.29"></a><h4> UI cmds (in CourseServlet) </h4> +<ul><li> createcourse (return code = 1001) +</li><li> updatecourse (return code = 1002) +</li><li> deletecourse (return code = 1003) +</li><li> createcoursemodule (return code = 1011) +</li><li> updatecoursemodule (return code = 1012) +</li><li> deletecoursemodule (return code = 1013) +</li><li> createcourseroom (return code = 1021) +</li><li> updatecourseroom (rc = 1022) +</li><li> deletecourseroom (rc = 1023) +</li><li> createcourselecturer (rc = 1031) +</li><li> updatecourselecturer (rc = 1032) +</li><li> deletecourselecturer (rc = 1033) +</li><li> createcourseprogram (rc = 1041) +</li><li> updaatecourseprogram (rc = 1042) +</li><li> deletecourseprogram (rc = 1043) +</li><li> addcoursett (rc = 1051) +</li><li> removecoursett (rc = 1052) +</li></ul> +<p>Generic return codes +</p> +<ul><li> 2000: noaccess +</li><li> 2100: error +</li></ul> +<p>TBD: request attributes +</p><p><br /> +</p> <a name="View_course"></a><h4> View course </h4> <p>Templatename : <strong>cview.html</strong> </p><p>This template is used to view a selected course. It is supposed for the student's default view of a course. The screenshot below shows how this template looks in the reference web interface. Index: index.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/index.html,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- index.html 10 Feb 2006 12:00:04 -0000 1.13 +++ index.html 24 Nov 2006 08:05:56 -0000 1.14 @@ -48,6 +48,7 @@ <ul><li> <a href="Course_UnivISSync.html" title ="Course UnivISSync">Synchronisation with UnivIS server</a> </li></ul> </li><li> <a href="Voting_doc.html" title ="Voting doc">Voting Component</a> +</li><li> <a href="Agent_doc.html" title ="Agent doc">Agent Component</a> </li></ul> </li></ul> <ul><li> Cobricks-2 Extensions Index: Portal_doc.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/Portal_doc.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Portal_doc.html 10 Feb 2006 12:00:03 -0000 1.10 +++ Portal_doc.html 24 Nov 2006 08:05:56 -0000 1.11 @@ -579,6 +579,16 @@ TBD </pre> +<p>The return codes of the portal servlet are: +</p> +<pre> + 1200 login success + 2200 login error + 2201 login error: userlogin does not exist + 2202 login error: password not correct + +TBD +</pre> <p>In the following subsections we briefly describe the default user interface of the portal container component. All these functions only address pages that are stored in the database. Pages in the file system webspace can be read only for being displayed. </p> <a name="Edit_Page"></a><h4> Edit Page </h4> Index: Env_doc.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/Env_doc.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Env_doc.html 10 Feb 2006 12:00:03 -0000 1.10 +++ Env_doc.html 24 Nov 2006 08:05:56 -0000 1.11 @@ -158,17 +158,16 @@ </p><p>For anonymous access use: </p> <pre> -cvs -d:pserver:ano...@cv...:/cvsroot/cobricks login -cvs -z3 -d:pserver:ano...@cv...:/cvsroot/cobricks co -P cobricks2 +cvs -d:pserver:ano...@co...:/cvsroot/cobricks login +cvs -z3 -d:pserver:ano...@co...:/cvsroot/cobricks co -P cobricks2 </pre> <p>For developer access (with write privileges) use: </p> <pre> export CVS_RSH=ssh -cvs -z3 -d:ext:dev...@cv...:/cvsroot/cobricks co -P cobricks2 +cvs -z3 -d:ext:dev...@co...:/cvsroot/cobricks co -P cobricks2 </pre> <p>See Appendix A for more information on how to access the CVS repository. -</p><p><br /> </p> <a name="Adapting_the_configuration"></a><h3> Adapting the configuration </h3> <p>For compiling or running the distribution you have to adapt the configuration in two places, in the âCOBRICKS_DIR/build.propertiesâ file and in the âCOBRICKS_DIR/conf/localproperties.txtâ file. @@ -729,15 +728,14 @@ </li></ul> <a name="Required_Documentation"></a><h3> Required Documentation </h3> <a name="Design_documentation"></a><h4> Design documentation </h4> -<p>There is a OpenOffice document for every component (plus one document describing the overall architecture, and one for the development environment - this one). In these documents the following information should be documented: +<p>There is at least one wiki page for every component (plus one document describing the overall architecture, and one for the development environment - this one). In these documents (or additional pages generated by you) the following information should be documented: </p> <ul><li> Component specification </li><li> Use case diagram </li><li> Class diagram </li><li> Sequence diagram </li></ul> -<p>The design documentation should describe the design and the usage of the component (API and default/demo user interface). The documents are included in the CVS repository (directory /docs), but should not be edited by everybody like the source code. Please submit changes to a design document to the user listed in the preface of the document - or ask this user to (temporarily) transfer ownership of the document to you for making changes. -</p><p>Diagrams and images that are used in the documents should also be created using OpenOffice and be provided with the source of the main documents. +<p>The design documentation should describe the design and the usage of the component (API and default/demo user interface). </p> <a name="Help_.2F_User_documentation"></a><h4> Help / User documentation </h4> <ul><li> javadocs must provide sufficient information regarding component design and usage Index: User_doc.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/User_doc.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- User_doc.html 10 Feb 2006 12:00:04 -0000 1.10 +++ User_doc.html 24 Nov 2006 08:05:56 -0000 1.11 @@ -31,12 +31,21 @@ <a href="User_doc.html#Access_Control">2.5 Access Control</a><br /> <a href="User_doc.html#Context_Interface">2.6 Context Interface</a><br /> <a href="User_doc.html#Component_Events">2.7 Component Events</a><br /> -<a href="User_doc.html#Misc">2.8 Misc</a><br /> +<a href="User_doc.html#Social_Networks">2.8 Social Networks</a><br /> </p> <div class="tocindent"> -<p><a href="User_doc.html#User_Interests">2.8.1 User Interests</a><br /> -<a href="User_doc.html#User_Groups">2.8.2 User Groups</a><br /> -<a href="User_doc.html#Extensions">2.8.3 Extensions</a><br /> +<p><a href="User_doc.html#Calculating_all_paths">2.8.1 Calculating all paths</a><br /> +<a href="User_doc.html#Calculating_the_shortest_path">2.8.2 Calculating the shortest path</a><br /> +<a href="User_doc.html#Floyd-Warshall_implementation">2.8.3 Floyd-Warshall implementation</a><br /> +<a href="User_doc.html#Bidirectional_Search_implementation">2.8.4 Bidirectional Search implementation</a><br /> +</p> +</div> +<p><a href="User_doc.html#Misc">2.9 Misc</a><br /> +</p> +<div class="tocindent"> +<p><a href="User_doc.html#User_Interests">2.9.1 User Interests</a><br /> +<a href="User_doc.html#User_Groups">2.9.2 User Groups</a><br /> +<a href="User_doc.html#Extensions">2.9.3 Extensions</a><br /> </p> </div> </div> @@ -51,7 +60,12 @@ <div class="tocline"><a href="User_doc.html#User_Interface">4 User Interface</a><br /></div> <div class="tocindent"> <p><a href="User_doc.html#UserPresenter">4.1 UserPresenter</a><br /> -<a href="User_doc.html#UserServlet">4.2 UserServlet</a><br /> +</p> +<div class="tocindent"> +<p><a href="User_doc.html#Social_networks">4.1.1 Social networks</a><br /> +</p> +</div> +<p><a href="User_doc.html#UserServlet">4.2 UserServlet</a><br /> </p> <div class="tocindent"> <p><a href="User_doc.html#Register">4.2.1 Register</a><br /> @@ -181,7 +195,7 @@ </li><li> <a href="http://hostid/USER#XXXX" class='external' title="http://hostid/USER#XXXX">http://hostid/USER#XXXX</a> (the globalid) </li></ul> <pre> -public class de.cobricks.user.UserManager { +public class org.cobricks.user.UserManager { int getUserIdForUserLogin(String userlogin); int getUserIdForGlobalId(String globalid); @@ -233,6 +247,9 @@ void addListMember (int userid, int objectidToAdd, String attrname); void deleteListMember (int userid, int objectidToDelete, String attrname); +public List getUserPaths(int startuserid, int enduserid) throws CobricksException; +public List getUserPath(int startuserid, int enduserid) throws CobricksException; + } </pre> <p>A user profile is represented in the system by the org.cobricks.user.User class (or a class that is derived from this class). [Like all classes representing basic data concepts, this class does not contain a reference to manager classes â if such a reference is needed for a method, it has to be passed to the method as a parameter.] @@ -472,6 +489,178 @@ </li><li> update of user objects </li><li> deletion of user objects </li></ul> +<a name="Social_Networks"></a><h3> Social Networks </h3> +<p>The methods for calculating paths between users are implemented in the class UserManager. A broader description of social networks can be found at <a href="Project_SocialNetwork.html" title ="Project SocialNetwork"> Project Social Networks</a> There you can also find a detailed description of the graph searching algorithms used here. +</p> +<a name="Calculating_all_paths"></a><h4> Calculating all paths </h4> +<pre> +List getUserPaths(int startuserid, int enduserid) throws CobricksException; +</pre> +<p>This method calculates all paths between startuserid and enduserid up to a path length of USER_GRAPH_MAX_PATH_SIZE using a bidirectional breadth-first search. One breadth-first search is going from the start-vertex to the end-vertex. The other search is going from the end-vertex to the start-vertex. +The pseudo-code of this method reads as follows: +</p> +<pre> +List pathsStartToEnd = [[startuserid]]; +List pathsEndToStart = [[endPath]; +List pathsStartToEndPrev = [[startPath]]; +List pathsEndToStartPrev = [[endPath]]; + +FOR pathlength = 2 TO MAX_PATH DO + pathsStartToEndPrev = expandStartToEndPaths(pathsStartToEndPrev); + pathsEndToStartPrev = expandEndToStartPaths(pathsEndToStartPrev); + + pathsStartToEnd = pathsStartToEnd + pathsStartToEndPrev; + pathsEndToStart = pathsEndToStart + pathsEndToStartPrev; +OD + +List foundPaths = interceptPaths(pathsStartToEnd, pathsEndToStart); +sortByPathLength(foundPaths); +return foundPaths; +</pre> +<p>The first two lists are used to collect all found paths. The next two lists contain the paths found during the previous iteration. +</p><p>The methods expandStartToEndPaths and expandEndToStartPaths get a list of paths and extends them by one element. Only the newly generated paths are returned. +</p> +<pre> +List expandStartToEndPaths(List paths); +</pre + +<pre> +newPaths = []; +FOR EARCH path OF paths DO + lastVertex = path.getLastElement(); + newVertices = getUserGraphOutgoing(lastVertex); + FOR EACH newVertex OF newVertices DO + newPath = path + newVertex; + newPaths = newPaths + newPath; + OD +OD +return newPaths; +</pre> +<p>The method expandEndToStartPaths works analog to the method shown here. +</p><p>The methods getUserGraphOutgoing and getUserGraphIncoming are used to get the relations between users. The method getUserGraphOutgoing gets a userid and returns the entries of the buddylist of the specified user. The method getUserGraphIncoming does return all the users that have added the specified user to their buddylist. +To access the database efficiently these two methods use a Last-Recently-Used (LRU) Cache. When requesting the buddylist of a user, that is not already available in the cache, it is loaded from the database and put into the cache at position 0. If the list would already be in the cache, it would be moved to the first position. Thus the frequently used entries are at the beginning of the cache. If the cache reaches a certain size and new entries have to be added, old entries at the end of the cache are remvoed. In Java a LRU-Cache can simply be implemented using a LinkedHashMap. +</p><p>The method interceptPaths gets two lists. The first list contains the paths that start from the startuserid. The second list contains the paths that start at the enduserid. This method searchs for a combination of a path of the first list, that ends with the same vertix as a path of the second list starts. +</p> +<pre> +List interceptPaths(List pathsStartToEnd, List pathsEndToStart); +</pre> +<pre> +foundPaths = []; +FOR EACH path1 OF pathsStartToEnd DO + FOR EACH path2 OF pathsEndToStart DO + IF path1.getLastElement() == path2.getFirstElement() THEN + path2.removeFirstElement(); + newpath = path1 + path2; + IF NOT containsDuplicateVertices(newpath) THEN + foundPaths = foundPaths + newpath; + FI + FI + OD +OD +return foundPaths; +</pre> +<a name="Calculating_the_shortest_path"></a><h4> Calculating the shortest path </h4> +<pre> +public List getUserPath(int startuserid, int enduserid) throws CobricksException { + /* 1st possibility */ + return getUserPathByFloydMarshall(startuserid, enduserid); + + /* 2nd possibility */ + //return getUserPathByBidirectionSearch(startuserid, enduserid); +} +</pre> +<p>This method is used to calculate (one of) the shortest path(s) between two users. As mentioned before there are two algorithms, that can be used for calculating the shortest path. You can choose between these algorithms by activating the desired method-call. +</p> +<a name="Floyd-Warshall_implementation"></a><h4> Floyd-Warshall implementation </h4> +<pre> +private List[][] floydWarshallMatrix = null; +private int[] allUserIds = null; +private HashMap userIdToIndex = null; +</pre> +<p>The array floydWarshallMatrix contains the Floyd-Warshall-matrix. Because the Floyd-Warshall-algorithm works with indices, we need to map indices to userids and backwards: The array allUserIds maps indices to userIds and the HashMap userIdToIndex maps userIds to indices. +</p><p>The method generateFloydWarshallMatrix() calculates the Floyd-Warshall-Matrix up to a maximum path length of USER_GRAPH_MAX_PATH_SIZE. First the matrix and the two mapping variables are initialized using the method initializeFloydWarshallMatrix(). This method also executes an SQL-query to get the user-relations: +</p> +<pre> +SELECT DISTINCT User.USERID, SINKUSERID FROM TABLE_USER_ATTRUSER + WHERE ANAME=User.BUDDYLIST +</pre> +<p>Then the calculation of the Floyd-Warshall-matrix is done: +</p> +<pre> +FOR pathlength=1 TO USER_GRAPH_MAX_PATH_SIZE - 2 DO + FOR from=0 TO users.size() DO + FOR to=0 TO users.size() DO + IF from != to AND + floydWarshallMatrix[from][to] == null THEN + FOR intermed=0 TO users.size() DO + IF from != intermed AND + intermed != to AND + floydWarshallMatrix[from][intermed] != null AND + floydWarshallMatrix[intermed][to] != null AND + floydWarshallMatrix[from][intermed].isEmpty() AND + floydWarshallMatrix[intermed][to].size() == pathlength - 1) THEN + + floydWarshallMatrix[from][to] = + floydWarshallMatrix[from][intermed] + + intermed + + floydWarshallMatrix[intermed][to]; + IF + OD + FI + OD + OD +OD +</pre> +<p>The outer loop iterates the Floyd-Warshall-algorithm USER_GRAPH_MAX_PATH_SIZE times. The three following loops try to seek a path from âfromâ to âtoâ that goes through the vertex âintermedâ. If such a path is found, it is saved at the proper position in the matrix. +</p><p>The method getUserPathByFloydMarshall(int startuserid, int enduserid) accesses the Floyd-Warshall-matrix and gets the already calculated path: +</p> +<pre> +IF âneccessaryâ THEN + generateFloydWarshallMatrix(); +FI +fromIndex = userIdToIndex[startuserid]; +toIndex = userIdToIndex[enduserid]; + +path = floydWarshallMatrix[fromIndex][toIndex]; +FOR EACH element OF path DO + userIdPath = userIdPath + indexToUserId[element]; +OD +RETURN userIdPath; +</pre> +<p>If the Floyd-Warshall-matrix was not already calculated, the method generateFloydWarshallMatrix() is used to calculate it. Then the start- and enduserids are translated to indices of the matrix. The matrix is accessed, to get a path consisting of indices. Then the path of indices has to be transformed to a path of userids. +</p> +<a name="Bidirectional_Search_implementation"></a><h4> Bidirectional Search implementation </h4> +<p>The bidirectional search for calculating the shortest path works similar to the method for calculating all paths. The major difference is that this algorithm is an iterative search. This means that the main loop terminates as soon as one path is found. Thus the method interceptPaths() is called within the loop. +</p> +<pre> +List getUserPathByBidirectionSearch(int startuserid, int enduserid); +</pre> +<pre> +List pathsStartToEnd = [[startuserid]]; +List pathsEndToStart = [[endPath]; +List pathsStartToEndPrev = [[startPath]]; +List pathsEndToStartPrev = [[endPath]]; +List foundPaths = []; + +FOR pathlength = 2 TO MAX_PATH DO + pathsStartToEndPrev = expandStartToEndPaths(pathsStartToEndPrev); + pathsEndToStartPrev = expandEndToStartPaths(pathsEndToStartPrev); + + pathsStartToEnd = pathsStartToEnd + pathsStartToEndPrev; + pathsEndToStart = pathsEndToStart + pathsEndToStartPrev; + + foundPaths = interceptPaths(pathsStartToEnd, pathsEndToStart); + IF NOT foundPaths.isEmpty() THEN + break; + FI +OD + +sortByPathLength(foundPaths); +return foundPaths.getFirstElement(); + +</pre> +<p><br /> +</p> <a name="Misc"></a><h3> Misc </h3> <a name="User_Interests"></a><h4> User Interests </h4> <p>Users can be associated with categories (using category-Set user attributes). These associations have a context class attribute that defines what type of relationship is defined in the attribute. In the User Component interest relationships (for different channels â category class ContextInterests) can be defined. Member and admin relationships (ContextMembers, ContextAdmin) are defined in the Category Component. The functions addListMember() and deleteListMember() in UserManager are for add/delete of the elements in the user interests list. In the case of adding of a new element, the element will be saved in the database in the table user_attrcategory (see Appendix C: Database Model, userid â id of user, that is an owner of the interests list, aname - âinterests.categoriesâ, contextclass â ContextInterests, categoryid), if an element must be deleted, it will be deleted from this table(... where userid = userid, categoryid = categoryid). In both cases the attribute of the user object must be new set locally setAttributeLocally() function of user object, becouse the user object is available in user cache. @@ -492,8 +681,6 @@ </li><li> Calendar </li><li> Contacts </li></ul> -<p><br /> -</p> <a name="User_Attributes"></a><h2> User Attributes </h2> <p>There is a org.cobricks.user.attribute package for managing of user attributes. </p> @@ -587,7 +774,8 @@ <pre> public class de.cobricks.user.UserPresenter { -public String checkPermission(String userid, String domain, String action, String attrs); public AccessRole getAccessRole(String tmps); +public String checkPermission(String userid, String domain, String action, String attrs); +public AccessRole getAccessRole(String tmps); public List getAccessPermissions(String tmps); public List getAccessRoleUsers(String tmps); public List getAccessRolesByUser(String tmps); @@ -602,6 +790,11 @@ public String printDescription (int userid, String attrname, String lang); public Set getUserAttrSet(int userid, String attrname); + +public List getUserPath(int startuserid, int enduserid); +public List getUserPaths(int startuserid, int enduserid); +} + </pre> <p>The UserPresenter class functions are for all actions that make no changes on the database and for help purposes for supporing the user interface. </p><p>There is retrieving user for business card (card.html) â method getUserAttributes(), getUserAttrSet() is help function for getting of user attributes of type Set (user-buddylist.html and user_interests.html), search for users (search.html) â method searchUsers(). There is a one function for generating input tags on the user profile page â printUserAttrInput(). @@ -610,6 +803,49 @@ </p><p>The function printUserAttrInput() with parameters int userid and String attrname. On the user interface pages the input tags should be generated with a function of UserPresenter â this way, the user profile model can be used to determine the form of the input elements, and the value for the input element can be automatically obtained from the user profile. Input tags for all attributes, except attributes, that have own page (for example, user-buddylist and user-interests), will be generated with this method. </p><p>There is a function printDescription() for a getting of the description of an attribute of user defined in the user ontology. It takes userid, name of attribute (attrname) and desired language of the description as parameters. This method prints out the description of an user attribute defined in the ontology. If the ontology does not contain a description in the given language, the default language is used. The appropriate description if available, an empty String otherwise. </p> +<a name="Social_networks"></a><h4> Social networks </h4> +<p>The methods getUserPath and getUserPaths are used to calculate paths between users. It takes two userids as parameters. The first userid is the start-userid and the second is the end-userid. +</p> +<ul><li> The method getUserPath returns (one of) the shortest path(s) between startuserid and enduserid. The list consists of the user-objects of the path. If no path is found an empty list is returned. +</li><li> The method getUserPaths returns all paths up to a certain length from startuserid to enduserid. If no paths are found an empty list is returned. +</li></ul> +<p>Detailed information about the path calculation can be found at <a href="Project_SocialNetwork.html" title ="Project SocialNetwork">Project Social Network</a> and <a href="User_doc.html#Social_Networks" title ="User doc">User documentation</a>. +</p><p>Code example for calculating the shortest path: +</p> +<pre> +#set ($result = $userPresenter.getUserPath($loggedinid, $auserid)) +#set ($resultsize = $result.size()) +#if ($resultsize == 0) + No path to this user found. +#else + Path: + #foreach ($i in $result) + #set ($userLogin = $i.getUserLogin()) + $userLogin => + #end +#end +</pre> +<p>The shortest path between $loggedinid and $auserid is calculated. If the resulting list is empty, no path was found. Otherwise the list contains user-objects, that can be printed user a foreach loop. +</p><p>Code example for calculating all paths: +</p> +<pre> +#set ( $paths = $userPresenter.getUserPaths($userida, $useridb) ) +#set ( $pathssize = $paths.size() ) +Number of found paths: $pathssize<br> +<ul> +#foreach ($path in $paths) + <li> + #foreach ($i in $path) + #set ( $useri = $userManager.getUser($i) ) + #set ($userLogin = $useri.getUserLogin() ) + $userLogin ; + #end + </li> +#end +</ul> +</pre> +<p>The method returns a list of paths. Every path is a list of userids. +</p> <a name="UserServlet"></a><h3> UserServlet </h3> <p>The user components servlet can be accessed using the URL â/USERâ provides the following targets: </p> @@ -637,6 +873,45 @@ cmd=deleteListMember cmd=addListMember </pre> +<p>The commands result in return codes that can be evaluated in the result templates. +This list compiles all the return codes of this servlet: +</p> +<pre> +000- success + 1020 successfully registered user + 1030 successfully reset email + 1040 successfully changed password + 1050 successfully deleted user + 1060 successfully updated user + 1110 successfully added buddy list member + 1120 successfully removed buddy list member + +2000- error + 2000 generic error + 2001 user login is missing or illegal + 2003 email missing or illegal + 2006 password missing or illegal + 2007 password does not match validation + 2008 password does not match + + 2020 failed registering user + 2021 user already exists + 2022 failed sending email + 2025 firstname, lastname missing + 2027 additional attributes missing + + 2030 failed resetting password + 2031 userlogin and email not existing + 2032 failed sending email + + 2040 failed changing password + 2050 failed deleting user + 2060 failed updating user + 2110 failed adding buddy list member + 2120 failed removing buddy list member +</pre> +<p>Missing: codes for access role, access permission functions. +</p> <a name="Register"></a><h4> Register </h4> <p>For user register action is the function performRegister() responsible. The input variable attrrequ contains names of all user attributes, that must to be provided for registration. The input variable attrnames contains names of another user attributes, that can be provided by user by registration. The names for attributes will be taken from the ontology, but instead of point â.â is used underline â_â for subordination for levels. For example : basic.contact.online.email is basic_contact_online_email. </p><p>UserServlet checks all user attributes: userlogin, firstname, lastname, e-mail address and some other attributes, if requested for registration.The length of userlogin must be between 5 and 20 characters. The login name should not contain spaces or special characters (except ".", "-" und "_"). UserServlet check this conditions with regular expression: @@ -695,7 +970,7 @@ </p> <a name=".2Fuser.2Fuser-buddylist.html.3Fuserlogin.3D"></a><h4> /user/user-buddylist.html?userlogin= </h4> <a name=".2Fuser.2Fuser-interests.html.3Fuserlogin.3D"></a><h4> /user/user-interests.html?userlogin= </h4> -<p><a href="http://131.159.24.138/wiki/mw/index.php/Image:User_doc_sd3.jpg" class="image" title="Image:User_doc_sd3.jpg"><img src="User_doc_sd3.jpg" alt="Image:User_doc_sd3.jpg" /></a> +<p><a href="http://131.159.24.138/wiki/mw/index.php/Image:Buddylist.jpg" class="image" title="Image:buddylist.jpg"><img src="Buddylist.jpg" alt="Image:buddylist.jpg" /></a> </p><p>It is possible to change the password on this page. </p><p>/user/change_password.html?userlogin= </p> Index: Message_doc.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/Message_doc.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Message_doc.html 10 Feb 2006 12:00:03 -0000 1.6 +++ Message_doc.html 24 Nov 2006 08:05:56 -0000 1.7 @@ -54,15 +54,14 @@ </td></tr></table> <a name="Overview"></a><h2> Overview </h2> <p>The Message Component provides a user messaging facility. In contrast to generic messaging infrastructures this component is not targeted to component-to-component messaging, but just to messaging that is directed to users. The source of the messages can be a platform component or another user. -</p><p>Since the focus of the component are users, the component is mainly about how to reach the user (different message channels) and about rules the user can define for what messages should reach her through which channel. -</p><p>One of the channels includes an internal mailbox. -</p><p>TBD: Message component use cases -</p><p>Two different ways for generating messages +</p><p>Sources of messages can be </p> -<ul><li> publish: user, component -</li><li> notification component, subscription +<ul><li> other users (explicitly sending messages) +</li><li> the system - generating notification messages from component events upon user subscriptions (see below) </li></ul> -<p><br /> +<p>Since the focus of the component are users, the component is mainly about how to reach the user (different message channels) and about rules the user can define for what messages should reach her through which channel. +</p><p>One of the channels includes an internal mailbox. The other channels supported in the basic version of Cobricks are: email, event (show in web ui), newsletterd, newsletterw (store for a daily or weekly newsletter). +</p><p><br /> </p> <a name="Functionality"></a><h2> Functionality </h2> <pre> @@ -85,7 +84,6 @@ String senderdescription â optional, especially when system component String subject String content -String mobilenumber? String email String recipients â explicit list of user ids, category id, combination of user profile attributes (constraints) int messagetype @@ -113,43 +111,50 @@ </li><li> the channels will be taken from the user profile â every user determines for delivery preferences, which channel should be used: push-with-immediate-priority, push-with-urgent-priority, push-with-normal-priority, to-be-pulled </li></ul> <a name="Notification_Messages.2C_Subscriptions"></a><h3> Notification Messages, Subscriptions </h3> -<p>The message component can receive notifications from other components via the component messaging (see Section ). -</p><p>When a notification comes in it is matched to user specific rules that determine if this event should be forwarded to a user, and which channel should be used to forward the event. +<p>The message component receives notifications from other components via the component messaging (see <a href="Core_doc.html" title ="Core doc">Core doc</a>). +</p><p>When a notification comes in it is matched to user specific rules that determine if this event should be forwarded to a user, and which channel should be used to forward the event - these are called subscriptions. </p><p>The subscription rules just define patterns for the events fields: </p> <ul><li> sourceComponentId â any string pattern including wildcards like * and ? </li><li> domain â any string pattern including wildcards like * and ? </li><li> eventType â any string pattern including wildcards like * and ? </li><li> userId â either a particular id, or a user role +</li><li> a more complex "condition" field </li></ul> <p>and assign one of the available message channels (see below). -</p><p>In general: components send events to the message component (if configured in the properties), in the message component we have rules plus settings that decide if event is interesting for a user, and if yes, what channel should be used for that event at the given time according to the given status of the user etc. In the rules application/resource specific functions can be used. -</p><p>The events are then formatted using a template (resource and channel specific) and sent to the selected channel. -</p><p>Resources supported for the beginning: +</p><p>The condition field in subscriptions can be used to define more complex conditions based on the user profile of the user and on the attributes of the object that caused the event. Currently, we support a very limited set of conditions only - but this will be extended in the future: </p> -<ul><li> Item: items, item annotations, related items (threads) -</li><li> User: user profile changes +<ul><li> item.categories in thisuser.interests.categories - send message if the item that caused the event (create, update) is assigned to a category that is part of the users interest profile +</li><li> user in thisuser.pim.network.buddylist - send message if the user object that caused the event (create, update) is referenced in the current users buddylist </li></ul> -<p>Subscriptions can be defined for: +<p>In general: components send events to the message component (if configured in the properties), in the message component we have rules plus settings that decide if event is interesting for a user, and if yes, what channel should be used for that event at the given time according to the given status of the user etc. In the rules application/resource specific functions can be used. +</p><p>The events are then formatted using a template and sent to the selected channel. The template name can be specified in the subscription. The name can be </p> -<ul><li> Categories: send newly published items, send information about new members -</li><li> Items: send updates, send newly published items that are related, send newly published annotations and attachments -</li><li> Users (restriction to set of user attributes possible): send new value if user attributes are changed â watch access rights! +<ul><li> a fully qualified URL +</li><li> a name relative to the directory "templates" in the directory where the class files from the message component are found - in this directory we provide some "standard" template +<ul><li> item.txt +</li><li> itemshort.txt </li></ul> -<p>Specify by: buddylist (user-list attribute in own user profile), community (members), all users (specify what has to change, what value a specific attribute has to become to trigger a notification) +</li><li> a name relative to the directory CONFDIR/org.cobricks.message/templates/ where CONFDIR is the location of your Cobricks configuration directory +</li></ul> +<p>The templates are parsed by Velocity. You can use all presenters and managers and the object that caused the event using the reference $obj. +</p><p><br /> </p> <a name="Message_Channels"></a><h3> Message Channels </h3> <p>Messages are sent to users via message channels. </p><p>In general, a message channel is a Java class, implementing the MessageChannel interface and registered with the MessageManager. </p><p>The following message channels are supported by default: </p> -<ul><li> internal mailbox -</li><li> component event (component messaging) â for volatile notifications â if the portal does support this -</li><li> email (immediate) -</li><li> instant messageing -</li><li> sms +<ul><li> mailbox - internal mailbox +</li><li> event - component event (component messaging) â for volatile notifications â if the portal does support this +</li><li> email - email (immediate) +</li><li> (instant messageing - not yet) +</li><li> (sms - not yet) +</li><li> newsletterd - daily newsletter per email +</li><li> newsletterw - weekly newsletter per email </li></ul> <p>Additional message channels can be added. +</p><p><br /> </p> <a name="E-Mail_Support"></a><h3> E-Mail Support </h3> <a name="Output"></a><h4> Output </h4> @@ -161,8 +166,7 @@ </p><p>Immediate notification emails are formatted using the templates TBD </p> <a name="Newsletters"></a><h4> Newsletters </h4> -<p>Functionality for mailbox - different mailboxes: newsletter -day ... -</p><p>The messages queued for newsletters are automatically sent every day, week and month. In this case the newsletter is constructed from header, events (every event is formatted independently using the template xxx â for content list a different one then for the content), footer. The from field of the mails is âmessage.email.senderâ, reply-to and sender is âmessage.email.receiveerrorsâ. +<p>Newsletters are currently realized as message channel. All messages to this cannel are appended in one file and sent to the user at the end of a day or week in one email. </p> <a name="Input"></a><h4> Input </h4> <p>It is possible to publish items and messages by email. See separate sections. TBD Index: LogBrowser.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/LogBrowser.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LogBrowser.html 10 Feb 2006 12:00:03 -0000 1.3 +++ LogBrowser.html 24 Nov 2006 08:05:56 -0000 1.4 @@ -23,6 +23,40 @@ </pre> <p>This entry in conf/log.properties will send all messages both to the console and to the port 4451 (default port for LogBrowser) on the localhost. </p><p>With "ant log" you than can start the log browser (default port is 4451). +</p> +<a name="Chainsaw_v.2"></a><h2> Chainsaw v.2 </h2> +<div class="thumb tright"><div style="width:352px;"><a href="http://131.159.24.138/wiki/mw/index.php/Image:Chainsaw_v2_screenshot.png" class="internal" title="Chainsaw screenshot"><img src="350px-Chainsaw_v2_screenshot.png" alt="Chainsaw screenshot" width="350" height="245" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="http://131.159.24.138/wiki/mw/index.php/Image:Chainsaw_v2_screenshot.png" class="internal" title="Enlarge"><img src="magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>Chainsaw screenshot</div></div></div> +<div class="thumb tright"><div style="width:252px;"><a href="http://131.159.24.138/wiki/mw/index.php/Image:Chainsaw_v2_screenshot2.png" class="internal" title="Chainsaw screenshot from "New Socket Receiver" Window"><img src="250px-Chainsaw_v2_screenshot2.png" alt="Chainsaw screenshot from "New Socket Receiver" Window" width="250" height="265" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="http://131.159.24.138/wiki/mw/index.php/Image:Chainsaw_v2_screenshot2.png" class="internal" title="Enlarge"><img src="magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>Chainsaw screenshot from "New Socket Receiver" Window</div></div></div> +<p><a href='http://logging.apache.org/log4j/docs/chainsaw.html' class='external' title="http://logging.apache.org/log4j/docs/chainsaw.html">Chainsaw Homepage</a><span class='urlexpansion'> (<i>http://logging.apache.org/log4j/docs/chainsaw.html</i>)</span> +</p><p>Chainsaw is more complex than the log browser but has more features. +</p> +<ul><li> Mark output from special packages or classes (with the tree view on the left) +</li><li> Display only certain levels (eg. WARN and above) +</li><li> Highlight levels with colour (customizable) +</li><li> Use with other projects +</li><li> And other things... (i don't use myself) +</li></ul> +<a name="Usage"></a><h3> Usage </h3> +<p><strong>log properties</strong> +</p> +<ul><li> Change the log properties (conf/log.properties) like above +</li></ul> +<p><strong>Chainsaw</strong> +</p> +<ul><li> Download the standalone version from the link above or use Java Web Start +</li></ul> +<p><strong>New Socket Receiver</strong> +</p> +<ul><li> Create a <strong>New Socket Receiver</strong> in the receiver box on the right. +</li><li> Give the receiver a name (e.g. "cobricks") +</li><li> Fill in the port from the properties file (here it is 4451) +</li><li> Optional: edit the threshold +</li><li> Click <strong>OK</strong> and you have your Socket Receiver +</li></ul> +<p><strong>There it is</strong> +</p><p>Now if Cobricks writes a log message the "localhost" tab will apear like in the screenshot. +</p><p><br /> +TBD I haven't found out yet how to save the socket receiver, but a new one it quickly done. </p><div class="printfooter"> Retrieved from "<a href="LogBrowser.html">http://131.159.24.138/wiki/mw/index.php/LogBrowser</a>"</div> Index: Projects.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/Projects.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Projects.html 10 Feb 2006 12:00:04 -0000 1.1 +++ Projects.html 24 Nov 2006 08:05:56 -0000 1.2 @@ -13,11 +13,11 @@ </li></ul> <ul><li> Integration of JCR API/JSR170 Interoperability </li></ul> -<ul><li> Integration of a Rule Engine into Cobricks - October 2005 till February 2006 by Tong Tong, Han Jiang, Ye Shen +<ul><li> <a href="Agent_doc.html" title ="Agent doc">Integration of a Rule Engine into Cobricks</a> - October 2005 till February 2006 by Tong Tong, Han Jiang, Ye Shen </li></ul> <ul><li> Generic Forum/Bulletin Board Functionality for Cobricks - November 2005 till May 2006 by Philipp Hemmer </li></ul> -<ul><li> Social Network Support (Calculating and Displaying Paths from User A to User B) - December 2005 till March 2006 by Klaus Lochmann +<ul><li> <a href="Project_SocialNetwork.html" title ="Project SocialNetwork">Social Network Support</a> (Calculating and Displaying Paths from User A to User B) - December 2005 till April 2006 by Klaus Lochmann </li></ul> <ul><li> Flash User Interfaces for Cobricks - Example for Visualizing Social Networks - January 2006 till ? by Jiran Wang </li></ul> Index: Item_Search.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/docs/Item_Search.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Item_Search.html 10 Feb 2006 12:00:03 -0000 1.4 +++ Item_Search.html 24 Nov 2006 08:05:56 -0000 1.5 @@ -6,104 +6,136 @@ </head> <body class="ns-0"> <!-- start content --> - <table border="0" id="toc"><tr id="toctitle"><td align="center"> -<b>Table of contents</b> <script type="text/javascript">showTocToggle("show","hide")</script></td></tr><tr id="tocinside"><td> -<div class="tocline"><a href="Item_Search.html#Search_Items">1 Search Items</a><br /></div> -<div class="tocindent"> -<p><a href="Item_Search.html#XML_representation_of_Items">1.1 XML representation of Items</a><br /> + <p><strong>Search Items</strong> +</p><p>This document describes the search functionality for items in the +<a href="Item_doc.html" title ="Item doc">Item Component</a>. </p> +<table border="0" id="toc"><tr id="toctitle"><td align="center"> +<b>Table of contents</b> <script type="text/javascript">showTocToggle("show","hide")</script></td></tr><tr id="tocinside"><td> +<div class="tocline"><a href="Item_Search.html#Structured_Search">1 Structured Search</a><br /></div> <div class="tocindent"> -<p><a href="Item_Search.html#String">1.1.1 String</a><br /> -<a href="Item_Search.html#Integer">1.1.2 Integer</a><br /> -<a href="Item_Search.html#Date">1.1.3 Date</a><br /> -<a href="Item_Search.html#Timestamp">1.1.4 Timestamp</a><br /> -<a href="Item_Search.html#Boolean">1.1.5 Boolean</a><br /> -<a href="Item_Search.html#Collection_.28Set_or_List.29">1.1.6 Collection (Set or List)</a><br /> -<a href="Item_Search.html#Cobricks_type_.28Item.2C_User_or_Category.29">1.1.7 Cobricks type (Item, User or Category)</a><br /> -<a href="Item_Search.html#Annotations_and_Attachments">1.1.8 Annotations and Attachments</a><br /> -<a href="Item_Search.html#Example_of_an_Item_representation_in_XML">1.1.9 Example of an Item representation in XML</a><br /> +<p><a href="Item_Search.html#Syntax_of_the_queries_used_in_searchItems.28String_query.29">1.1 Syntax of the queries used in searchItems(String query)</a><br /> </p> </div> -<p><a href="Item_Search.html#Structured_Search">1.2 Structured Search</a><br /> -</p> -<div class="tocindent"> -<p><a href="Item_Search.html#Syntax_of_the_queries_used_in_searchItems.28String_query.29">1.2.1 Syntax of the queries used in searchItems(String query)</a><br /> -<a href="Item_Search.html#Supported_database_types">1.2.2 Supported database types</a><br /> -<a href="Item_Search.html#Syntactical_characteristics">1.2.3 Syntactical characteristics</a><br /> -<a href="Item_Search.html#Grammar_references">1.2.4 Grammar references</a><br /> -<a href="Item_Search.html#Implementation">1.2.5 Implementation</a><br /> -</p> +<div class="tocline"><a href="Item_Search.html#XML_representation_of_Items">2 XML representation of Items</a><br /></div> <div class="tocindent"> -<p><a href="Item_Search.html#Searching_XML_database">1.2.5.1 Searching XML database</a><br /> -<a href="Item_Search.html#Searching_relational_database">1.2.5.2 Searching relational database</a><br /> +<p><a href="Item_Search.html#Example_of_an_Item_representation_in_XML">2.1 Example of an Item representation in XML</a><br /> +<a href="Item_Search.html#Details">2.2 Details</a><br /> +<a href="Item_Search.html#String">2.3 String</a><br /> +<a href="Item_Search.html#Integer">2.4 Integer</a><br /> +<a href="Item_Search.html#Date">2.5 Date</a><br /> +<a href="Item_Search.html#Timestamp">2.6 Timestamp</a><br /> +<a href="Item_Search.html#Boolean">2.7 Boolean</a><br /> +<a href="Item_Search.html#Collection_.28Set_or_List.29">2.8 Collection (Set or List)</a><br /> +<a href="Item_Search.html#Cobricks_type_.28Item.2C_User_or_Category.29">2.9 Cobricks type (Item, User or Category)</a><br /> +<a href="Item_Search.html#Annotations_and_Attachments">2.10 Annotations and Attachments</a><br /> </p> </div> -</div> -<p><a href="Item_Search.html#Outlook">1.3 Outlook</a><br /> +<div class="tocline"><a href="Item_Search.html#Implementation_-_Supported_database_types">3 Implementation - Supported database types</a><br /></div> +<div class="tocindent"> +<p><a href="Item_Search.html#Syntactical_characteristics">3.1 Syntactical characteristics</a><br /> +<a href="Item_Search.html#Grammar_references">3.2 Grammar references</a><br /> +<a href="Item_Search.html#Searching_XML_database">3.3 Searching XML database</a><br /> +<a href="Item_Search.html#Searching_relational_database">3.4 Searching relational database</a><br /> </p> </div> +<div class="tocline"><a href="Item_Search.html#Outlook">4 Outlook</a><br /></div> </td></tr></table> -<a name="Search_Items"></a><h2> Search Items </h2> -<p>This document describes the search functionality for items in the -<a href="Item_doc.html" title ="Item doc">Item Component</a>. -</p><p>The searchItems() function provides rich search features on an extended XML version of items. To take fully advantage of the possibilities the searchItems(String query) method offers one has to understand the structure of an item and its (extended/virtual) representation in XML. -</p> -<a name="XML_representation_of_Items"></a><h3> XML representation of Items </h3> -<p>Every attribute of an item is of a certain type. This relationship (types for attributes) are defined in the item ontology. A special XML representation exists for each type. In the following these XML representations are explained. -</p> -<a name="String"></a><h4> String </h4> -<p>The String value is just inserted between the tags with the particular attributename as name. -</p><p>Example: <location>Munich</location> -</p><p>String attributes can be declared as multilanguage in the item ontology. These attributes are represented differently in XML. The language identifiers (lower-case, two letter) of them are stored in the lang attribute of the corresponding tag. -</p><p>Example: <title lang=âenâ>Cobricks2</title> -</p> -<a name="Integer"></a><h4> Integer </h4> -<p>Integer objects are converted into Strings and then inserted between the correct tags. -</p><p>Example: <itemid>17</itemid> -</p> -<a name="Date"></a><h4> Date </h4> -<p>Date objects are converted into Strings by using a DateFormat that is based on the String INTERNAL_DATE_FORMAT of the class Item. The resulting Strings are then inserted between the correct tags. -</p><p>Example: <holidays>2004.07.23</holidays> -</p> -<a name="Timestamp"></a><h4> Timestamp </h4> -<p>Timestamp objects are converted into Strings by using a DateFormat that is based on the Strings INTERNAL_DATE_FORMAT and INTERNAL_TIME_FORMAT of the class Item. The resulting Strings are then inserted between the correct tags. -</p><p>Example: <creationtime>2004.04.27 12:53:01.849</creationtime> +<a name="Structured_Search"></a><h2> Structured Search </h2> +<p>The method searchItems(String query) of the ItemManager offers a very powerful way to search these XML documents either in an XML database (i.e. Xindice) or in a relational database. One can pass a XPath-like query to this method. The XPath-like query uses a syntax that extends the possibilities of 'normal' XPath and that is slightly different to the syntax of XPath. These differences are explained below. </p> -<a name="Boolean"></a><h4> Boolean </h4> -<p>Boolean objects are converted into Strings and the Strings are inserted between the corresponding tags. -</p><p>Example: <istToll>true</istToll> +<a name="Syntax_of_the_queries_used_in_searchItems.28String_query.29"></a><h3> Syntax of the queries used in searchItems(String query) </h3> +<p>The syntax of the queries is mainly the same as in XPath. There are only some differences: </p> -<a name="Collection_.28Set_or_List.29"></a><h4> Collection (Set or List) </h4> -<p>Collections are represented in XML as follows: The entries of the Collection are converted into Strings depending on their datatype. Afterwards these Strings are inserted between tags whose names are equivalent to the name of their former datatypes. Last the whole is enclosed with tags that have the corresponding attributename as name. -</p><p>Example: +<ul><li> One doesn't have to put an '@' in front of an XML attribute. XML attributes used in the documents that represent Items are 'id' and 'lang'. +</li><li> One can use a path instead of a constraint to specify a condition. +</li><li> For the attribute 'title' one can determine the language in which the 'title' has to be defined by adding a corresponding language suffix. +</li><li> Sets can be connected with 'and' and 'or', instead of 'additional constraints' and '|'. +</li><li> When querying on String attributes one can specify the evaluation mode by surrounding the String-value either with single quotes or double quotes. Surrounding the String-value with single quotes indicates strict evaluation, surrounding the String-value with double quotes indicates non-strict evaluation. Strict evaluation means that the String-value specified in the query and the String-value of the particular attribute must be exactly the same in order to result in a match. With non-strict evaluation the String-value of the queried attribute must only include the String-value of the query as substring. When comparing the String-values, the case of the characters is ignored. +</li><li> One can query on all attributes of additions (ItemAnnotation or ItemAttachment) or Cobricks types (Item, User or Category) although only the id of these types is stored in the corresponding XML document. As well one can query on all attributes of the creator of an addition. +</li><li> When querying on Date or Timestamp attributes one can use the special constructs 'TODAY', 'TODAY-int' and 'TODAY+int'. They stand for 'today', 'int days before today' or 'int days after today'. In addition one can utilize the operators '=', '!=', '<', '>', '<=' and '>='. +</li><li> It is possible to compare an objectclass attribute to a class name and all the classes derived from this name (as defined in the ontology) +</li></ul> +<p>Some examples to illustrate these differences: </p> <pre> - <authors> - <string>Goethe</string> - <string>Schiller</string> - </authors> +1. /item/title[lang="de"] + /item/creator[id=12] +2. /item/itemid=12 +3. /item/title_en="Cobricks" +4. /item/title_en='Manager' and /item/itemid>12 + /item[itemclass='msg'] or /item/categories[catid=12 or catid=13] +5. /item/title_en='Cobricks' + /item/title_en="bricks" +6. /item/annotations/annotation/rating<3 + /item/attachments/attachment/size=512 + /item/ref/title_de='Cobricks' + /item/creator/login='test@localhost' + /item/categories/category/categoryclass='portalfolder' + /item/annotations/annotation/creator/lastname='Gates' + /item/attachments/attachment/creator/firstname='Bill' +7. /item/creationtime<=TODAY + /item/creationtime>=TODAY-5 + /item/expirationtime=TODAY+7 </pre> -<p>In Cobricks it's only possible to define Sets of Strings, Sets of Integers, Sets of Items, Sets of Users, Sets of Categories and Lists of Strings. -</p> -<a name="Cobricks_type_.28Item.2C_User_or_Category.29"></a><h4> Cobricks type (Item, User or Category) </h4> -<p>Cobricks types are represented in XML as follows: The corresponding attributename is used as tagname and the localid of the particular type (Item, User or Category) is used as id attribute. -</p><p>Example: <creator id=â34â/> -</p><p>Comment: The Cobricks types Item, User and Category cannot be searched by the id only, but also by their other attributes. Therefore, the XML representation of the types virtually extends into the attributes of these types: -</p><p>Example: +<p>Some more examples for search queries: </p> +<ul><li> Search for items that have attributes with a given value: +</li></ul> <pre> -<creator id="34"> - <firstname>Michael</firstname> - ... -</creator> + /item[itemid=12] or /item/itemid=12 + /item[title_en='Manager'] or /item/title_en='Manager' + /item/creator/login='test@localhost' </pre> -<a name="Annotations_and_Attachments"></a><h4> Annotations and Attachments </h4> -<p>Annotations and Attachments are represented in XML like the Cobricks types. -</p><p>Example: <annotation id=â324â/> -</p><p>Comment: As with Cobricks types, annotations and attachments also can be searched by attributes of annotations and attachments or their sub-attributes. See the following example for more information. +<ul><li> search for all items of class wikipage or classes derived from wikipage +</li></ul> +<pre> + /item[itemclass~'wikipage'] +</pre> +<ul><li> Search for items that have attributes that are greater than a given value: +</li></ul> +<pre> + /item[itemid>12] or /item/itemid>12 +</pre> +<ul><li> AND: Search for items that meet several conditions: +</li></ul> +<pre> + /item[title_en='Manager' and itemid>12] or + /item/title_en='Manager' and /item/itemid>12 + /item[title_de='Hiwi'] and /item/creator/login='test@localhost' +</pre> +<ul><li> AND/OR: Combining complex conditions: +</li></ul> +<pre> + /item[(itemclass='msg' or itemclass='date') and title_de='Hiwi'] + /item[itemclass='msg'] and /item/categories[category=12 or + category=13] +</pre> +<ul><li> Comparing Strings and Dates: +</li></ul> +<pre> + /item[itemclass='msg' and publisheddate<TODAY-10] + /item/itemclass='msg' and /item/publisheddate<TODAY-10 +</pre> +<ul><li> attribute values in set +</li></ul> +<pre> + /item['de' in {description/lang, title/lang}] +</pre> +<ul><li> Cobricks types: user, category, item +</li></ul> +<pre> + /item/creator/login='test@localhost' + /item/categories/category/categoryclass='portalfolder' + /item/ref/title_de='title of courseclass item' +</pre> +<p><br /> +</p> +<a name="XML_representation_of_Items"></a><h2> XML representation of Items </h2> +<p>The search function works on virtual XML representations of items (and applied the extended xpath terms to these. In this section we will present some more details on how these virtual XML representations look like. </p><p><br /> </p> -<a name="Example_of_an_Item_representation_in_XML"></a><h4> Example of an Item representation in XML </h4> +<a name="Example_of_an_Item_representation_in_XML"></a><h3> Example of an Item representation in XML </h3> <p>In the following an example of an Item converted into a XML representation to show the Item as a whole. </p> <pre> @@ -189,92 +221,62 @@ </attachments> </item> </pre> -<a name="Structured_Search"></a><h3> Structured Search </h3> -<p>The method searchItems(String query) of the ItemManager offers a very powerful way to search these XML documents either in an XML database (i.e.Xindice) or in a relational database. One can pass a XPath query, a XPath-like query or a mixture of both to this method. The XPath-like query uses a syntax that extends the possibilities of 'normal' XPath and that is slightly different to the syntax of XPath. These differences are explained below. +<a name="Details"></a><h3> Details </h3> +<p>Every attribute of an item is of a certain type. This relationship (types for attributes) are defined in the item ontology. A special XML representation exists for each type. In the following these XML representations are explained. </p> -<a name="Syntax_of_the_queries_used_in_searchItems.28String_query.29"></a><h4> Syntax of the queries used in searchItems(String query) </h4> -<p>The syntax of the queries is mainly the same as in XPath. There are only some differences: +<a name="String"></a><h3> String </h3> +<p>The String value is just inserted between the tags with the particular attributename as name. +</p><p>Example: <location>Munich</location> +</p><p>String attributes can be declared as multilanguage in the item ontology. These attributes are represented differently in XML. The language identifiers (lower-case, two letter) of them are stored in the lang attribute of the corresponding tag. +</p><p>Example: <title lang=âenâ>Cobricks2</title> </p> -<ul><li> One doesn't have to put an '@' in front of an XML attribute. XML attributes used in the documents that represent Items are 'id' and 'lang'. -</li><li> One can use a path instead of a constraint to specify a condition. -</li><li> For the attribute 'title' one can determine the language in which the 'title' has to be defined by adding a corresponding language suffix. -</li><li> Sets can be connected with 'and' and 'or', instead of 'additional constraints' and '|'. -</li><li> When querying on String attributes one can specify the evaluation mode by surrounding the String-value either with single quotes or double quotes. Surrounding the String-value with single quotes indicates strict evaluation, surrounding the String-value with double quotes indicates non-strict evaluation. -</li></ul> -<p>Strict evaluation means that the String-value specified in the query and the String-value of the particular attribute must be exactly the same in order to result in a match. With non-strict evaluation the String-value of the queried attribute must only include the String-value of the query as substring. When comparing the String-values, the case of the characters is ignored. +<a name="Integer"></a><h3> Integer </h3> +<p>Integer objects are converted into Strings and then inserted between the correct tags. +</p><p>Example: <itemid>17</itemid> </p> -<ul><li> One can query on all attributes of additions (ItemAnnotation or ItemA... [truncated message content] |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:30
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/core Modified Files: CoreManager.java OntologyClass.java Log Message: Index: CoreManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/CoreManager.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- CoreManager.java 18 Oct 2006 16:47:49 -0000 1.16 +++ CoreManager.java 24 Nov 2006 08:05:56 -0000 1.17 @@ -442,7 +442,9 @@ && (value instanceof Integer)) { UserManager userManager = (UserManager) componentDirectory.getManager("userManager"); - return userManager.getUser((Integer)value); + Object o = userManager.getUser((Integer)value); + if (o == null) o = userManager.getUser(0); + return o; } else if (type.equals("item") && !(value instanceof Item) && (value instanceof Integer)) { ItemManager itemManager = (ItemManager) Index: OntologyClass.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/OntologyClass.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- OntologyClass.java 3 Jan 2006 09:35:20 -0000 1.8 +++ OntologyClass.java 24 Nov 2006 08:05:56 -0000 1.9 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. + * Copyright (c) 2003-2006 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -131,8 +131,8 @@ if (oca != null) return oca; OntologyClass oc = this.getParent(); if (oc!= null) { - // there is a parent ontology class and the attribute was not found, - // -->lookup at the parent ontology class. + // there is a parent ontology class and the attribute was not + // found, --> lookup at the parent ontology class. return oc.getAttribute(attrname); } return null; |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:30
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/category In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/category Modified Files: CategoryPresenter.java CategoryServlet.java properties.txt Log Message: Index: CategoryPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/CategoryPresenter.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- CategoryPresenter.java 14 Sep 2006 12:21:26 -0000 1.21 +++ CategoryPresenter.java 24 Nov 2006 08:05:56 -0000 1.22 @@ -522,9 +522,6 @@ userList = userManager.searchUsers(attrs); } - logger.info("!!! print user attribute "+aname+"="+requestVal); - logger.info("!!! "+requestVal.getClass().getName()); - String my_value = ""; if (requestVal != null) my_value = requestVal; Index: CategoryServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/CategoryServlet.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- CategoryServlet.java 22 Sep 2006 17:28:54 -0000 1.18 +++ CategoryServlet.java 24 Nov 2006 08:05:56 -0000 1.19 @@ -119,12 +119,11 @@ OntologyClass oc = ontology.getClass(classname); Set attr_list = oc.getAttributeNames(); Iterator it = attr_list.iterator(); - while(it.hasNext()){ + while (it.hasNext()){ String aname = (String)it.next(); OntologyClassAttr oca = oc.getAttribute(aname); if (oca.isMultiLanguage()){ String[] usedLangs = lang.split(","); - logger.info("lang = "+lang); for (int j =0;j<usedLangs.length;j++){ String avalue = prequest.getRequestParameter(aname+"_"+usedLangs[j]); Index: properties.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/properties.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- properties.txt 22 Sep 2006 17:28:54 -0000 1.3 +++ properties.txt 24 Nov 2006 08:05:56 -0000 1.4 @@ -16,4 +16,4 @@ org.cobricks.category.comp.presenter.1.class=org.cobricks.category.CategoryPresenter org.cobricks.category.comp.listento= -category.cache.maxsize=1250 \ No newline at end of file +category.cache.maxsize=5000 \ No newline at end of file |
|
From: Michael K. <ko...@us...> - 2006-11-24 08:06:30
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/course/db In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv375/src/org/cobricks/course/db Modified Files: course_module.xml course_progrel.xml Log Message: Index: course_progrel.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/db/course_progrel.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- course_progrel.xml 29 May 2006 08:46:30 -0000 1.3 +++ course_progrel.xml 24 Nov 2006 08:05:56 -0000 1.4 @@ -8,6 +8,7 @@ <column name="cpendsem" type="int"/> <column name="cptype" type="varchar(2)"/> <column name="cpcomment" type="text"/> + <column name="cpcomment_en" type="text"/> </tablelayout> </table> Index: course_module.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/db/course_module.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- course_module.xml 11 Jul 2006 10:27:03 -0000 1.3 +++ course_module.xml 24 Nov 2006 08:05:56 -0000 1.4 @@ -8,6 +8,7 @@ <column name="cmname" type="varchar(200)"/> <column name="cmname_en" type="varchar(200)"/> <column name="cmshortname" type="varchar(30)"/> + <column name="cmshortname2" type="varchar(30)"/> <column name="cmtype" type="varchar(20)"/> <column name="cmectscredits" type="float(6)"/> |