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-02-16 15:21:16
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8500/org/cobricks/portal Modified Files: InitServlet.java Log Message: Index: InitServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/InitServlet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- InitServlet.java 10 Aug 2005 13:35:34 -0000 1.8 +++ InitServlet.java 16 Feb 2006 15:21:08 -0000 1.9 @@ -106,13 +106,14 @@ try { // load Velocity properties Properties velocityProperties = new Properties(); - PropertiesUtil.loadPropertiesResource("org.cobricks.portal", - "velocity/velocity.properties", - velocityProperties, - coreManager); + PropertiesUtil. + loadPropertiesResource("org.cobricks.portal", + "velocity"+File.separator + +"velocity.properties", + velocityProperties, + coreManager); velocityProperties.put("file.resource.loader.path", - configDir+File.separator - +"org.cobricks.portal"); + configDir); Velocity.setApplicationAttribute("coreManager", coreManager); Velocity.init(velocityProperties); logger.info("Velocity succesfully initialized"); |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:21:16
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/message/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8500/org/cobricks/message/templates Added Files: item.txt itemshort.txt Log Message: --- NEW FILE: item.txt --- ITEM PUBLISHED ON COBRICKS PLATFORM (created by by $obj.getAttributeQualified("creator",$coreManager).getName() at $portalPresenter.formatDate($obj.getAttribute("creationtime"))) $obj.getTitle() $corePresenter.formatText($obj.getContent(),76,-1) --- NEW FILE: itemshort.txt --- TITLE: $obj.getTitle() (created by by $obj.getAttributeQualified("creator",$coreManager).getName() at $portalPresenter.formatDate($obj.getAttribute("creationtime"))) $corePresenter.formatText($obj.getContent(),76,5) |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:21:16
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/message/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8500/org/cobricks/message/db Modified Files: tables.txt Added Files: msg_newsletter.xml Log Message: Index: tables.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/message/db/tables.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tables.txt 7 Dec 2005 14:01:11 -0000 1.2 +++ tables.txt 16 Feb 2006 15:21:08 -0000 1.3 @@ -2,3 +2,4 @@ msg_mailboxattrs msg_msgqueue msg_subscriptions +msg_newsletter \ No newline at end of file --- NEW FILE: msg_newsletter.xml --- <tabledescriptor tablename="msg_newsletter"> <table version="1"> <tablelayout> <column name="msgid" type="int" primarykey="true"/> <column name="userid" type="int" notnull="true"/> <column name="nlname" type="varchar(20)" notnull="false"/> <column name="senderid" type="int" notnull="true"/> <column name="sender" type="varchar(50)"/> <column name="senddate" type="timestamp"/> <column name="expirationdate" type="timestamp"/> <column name="subject" type="varchar(150)"/> <column name="content" type="text"/> <index name="msgnewsletter_msgid" unique="true"> <colname>msgid</colname> </index> <index name="msgnewsletter_userid"> <colname>userid</colname> </index> </tablelayout> </table> </tabledescriptor> |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:21:15
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8500/org/cobricks/core Modified Files: ComponentEvent.java ComponentEventImpl.java ConditionProcessor.java CorePresenter.java Log Message: Index: ComponentEvent.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/ComponentEvent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ComponentEvent.java 23 Feb 2004 08:20:58 -0000 1.4 +++ ComponentEvent.java 16 Feb 2006 15:21:06 -0000 1.5 @@ -30,6 +30,7 @@ public String getAction(); public int getUserId(); public void setUserId(int userid); + public void setObject(DataObject o); public int getObjectId(); public void setObjectId(int id); public int getObjectType(); @@ -41,4 +42,3 @@ public String getSourceComponentId(); } - Index: CorePresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/CorePresenter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CorePresenter.java 21 Oct 2005 15:56:46 -0000 1.6 +++ CorePresenter.java 16 Feb 2006 15:21:06 -0000 1.7 @@ -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 @@ -380,5 +380,41 @@ try { res = Integer.parseInt(s); } catch (Exception e) { } return new Integer(res); } + + + /** + * Format a string to be printed - + * add linebreaks, stop after a maximum of maxlines lines - + * if maxlines is -1 do not stop + */ + public String formatText(String s, int width, int maxlines) + { + StringBuffer result = new StringBuffer(""); + int linecount = 0; + while (true) { + int pos = s.indexOf("\n"); + if (pos > -1) { + String tmps = s.substring(0,pos); + s = s.substring(pos+1); + linecount += + formatTextLine(tmps, width, maxlines-linecount, result); + if (maxlines > 0 && linecount >= maxlines) + break; + } else { + formatTextLine(s, width, maxlines-linecount, result); + break; + } + } + return result.toString(); + } + + protected int formatTextLine(String s, int width, int maxlines, + StringBuffer result) + { + // TBD: currently we do not add linebreaks ... + result.append(s); + result.append("\n"); + return 1; + } } Index: ConditionProcessor.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/ConditionProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ConditionProcessor.java 23 Feb 2004 16:58:36 -0000 1.1 +++ ConditionProcessor.java 16 Feb 2006 15:21:06 -0000 1.2 @@ -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 @@ -13,7 +13,9 @@ package org.cobricks.core; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; +import java.util.Set; import org.apache.log4j.Logger; @@ -28,9 +30,10 @@ /** - * Implementation of a condition processor - i.e. a functionality that processes - * boolean conditions as defined in the Cobricks core components (e.g. User Component - * or Message Component) for determining access rights or for specifying subscriptions. + * Implementation of a condition processor - i.e. a functionality that + * processes boolean conditions as defined in the Cobricks core components + * (e.g. User Component or Message Component) for determining access rights + * or for specifying subscriptions. * * @author mic...@ac... * @version $Date$ @@ -65,18 +68,20 @@ * */ public boolean check(String condition, int userid1, int userid2, - int objectid, int objecttype) + int objectid, int objecttype, Object o) throws CobricksException { - boolean result = true; + boolean result = false; // prepare referenced objects Map objmap = new HashMap(); if (userid1 > 0) { + // user of rule User user = userManager.getUser(userid1); - if (user != null) objmap.put("me", user); + if (user != null) objmap.put("thisuser", user); } if (userid2 > 0) { + // user who sent event (who changed object) User user = userManager.getUser(userid2); if (user != null) objmap.put("user", user); } @@ -99,6 +104,39 @@ // evaluate condition // tbd + + // currently we support just a few conditions: + // item.categories.id=X + // item.categories.id in thisuser.interests.categories + // user.id=X + // user.id in thisuser.pim.network.buddylist + + if (condition. + equals("item.categories in thisuser.interests.categories")) { + User thisuser = (User)objmap.get("thisuser"); + Item item = (Item)objmap.get("itemobj"); + if (thisuser == null || item == null) return false; + Object o1 = thisuser.getAttribute("interests.categories"); + Object o2 = item.getAttribute("categories"); + Iterator i = ((Set)o2).iterator(); + while (i.hasNext()) { + Object o3 = i.next(); + if (((Set)o1).contains(o3)) { + return true; + } + } + return false; + } + else if (condition. + equals("user in thisuser.pim.network.buddylist")) { + // TBD + } + else if (condition.startsWith("item.categories.id=")) { + // TBD + } + else if (condition.startsWith("user.id=")) { + // TBD + } return result; } Index: ComponentEventImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/ComponentEventImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ComponentEventImpl.java 23 Feb 2004 16:58:09 -0000 1.5 +++ ComponentEventImpl.java 16 Feb 2006 15:21:06 -0000 1.6 @@ -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 @@ -102,6 +102,8 @@ { sourceobjectid = o.getId(); sourceobjecttype = o.getObjectType(); + if (content == null) + content = o; } public Object getContent() |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:21:15
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8500/org/cobricks/core/util Modified Files: PropertiesUtil.java ResourceUtil.java Log Message: Index: PropertiesUtil.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/util/PropertiesUtil.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- PropertiesUtil.java 10 Aug 2005 13:31:33 -0000 1.11 +++ PropertiesUtil.java 16 Feb 2006 15:21:07 -0000 1.12 @@ -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 @@ -35,9 +35,9 @@ /** - * First load localproperties.txt, check for the "components" property. + * First load localproperties.txt, check for the "components" attribute. * Then load the properties from the components, and finally load - * localproperties again. + * localproperties.txt again. */ static public void loadProperties(String configDir, Properties properties, CoreManager coreManager) @@ -55,8 +55,9 @@ if (complist == null || complist.endsWith("*")) { logger.info("Loading information for component list."); if (complist == null) { - complist = "org.cobricks.core,org.cobricks.user,org.cobricks.item," - +"org.cobricks.category,org.cobricks.context,org.cobricks.message," + complist = "org.cobricks.core,org.cobricks.user," + +"org.cobricks.item,org.cobricks.category," + +"org.cobricks.context,org.cobricks.message," +"org.cobricks.portal"; } else { complist = complist.substring(0, complist.length()-2); @@ -79,7 +80,8 @@ * */ static public void loadPropertiesFile(String dirname, String filename, - Properties properties, boolean warning) + Properties properties, + boolean warning) { try { InputStream is = null; @@ -88,12 +90,14 @@ is = ResourceUtil. getResourceAsStream("/conf/"+filename); if (is != null) - logger.info("Loading properties from resource /conf/"+filename); + logger.info("Loading properties from resource /conf/" + +filename); } else { File file = null; if (dirname != null) { - if (filename.startsWith("/") || filename.substring(1,2).equals(":")) { + if (filename.startsWith("/") || + filename.substring(1,2).equals(":")) { file = new File(filename); } else { file = new File(dirname + File.separator + filename); @@ -135,7 +139,8 @@ } } catch (Exception e) { if (warning) - logger.warn("Failed reading properties file "+dirname+"/"+filename); + logger.warn("Failed reading properties file " + +dirname+"/"+filename); } } @@ -173,7 +178,8 @@ } } } catch (Exception e) { - logger.warn(LogUtil.ex("Failed loading properties for "+compname, e)); + logger.warn(LogUtil.ex("Failed loading properties for " + +compname, e)); } } Index: ResourceUtil.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/util/ResourceUtil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ResourceUtil.java 8 Feb 2005 16:20:02 -0000 1.2 +++ ResourceUtil.java 16 Feb 2006 15:21:07 -0000 1.3 @@ -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 |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:19:18
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/message/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7897/templates Log Message: Directory /cvsroot/cobricks/cobricks2/src/org/cobricks/message/templates added to the repository |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:18:27
|
Update of /cvsroot/cobricks/cobricks2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7578 Modified Files: build.xml changelog.txt Log Message: Index: changelog.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/changelog.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- changelog.txt 3 Jan 2006 09:39:31 -0000 1.7 +++ changelog.txt 16 Feb 2006 15:18:18 -0000 1.8 @@ -17,7 +17,26 @@ - Added support for searching items with itemclass is equal or derived from a given itemclass - + +- Different handling of text objects and binary objects in the Portal + Component (using real mimetype information) + +- Support for public and authenticated user roles debugged and + activated +- support for access permissions in different components debugged + +- Added support for versioned item content +- Added support for Wiki pages in Portal Component (wiki language, + versioned content, support in demo ui) + +- Support for subscriptions implemented (you can now subscribe + to component events like item creations and get email or + messages as result) + +- Added new component to support agent/rule based actions + on component events - currently supporting the Drools rule + engine + Cobricks2 v0.35 - core: org.cobricks.core.util.MailUtil now reads Cobricks properties Index: build.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/build.xml,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- build.xml 3 Jan 2006 09:39:31 -0000 1.52 +++ build.xml 16 Feb 2006 15:18:18 -0000 1.53 @@ -5,7 +5,7 @@ installations, but add your property changes to build.properties --> -<project name="cobricks-2" default="compile" basedir="."> +<project name="cobricks2" default="compile" basedir="."> <!-- ==================== Property Definitions ========================== --> @@ -408,8 +408,13 @@ <target name="copydoc" description="Copies documentation from Wiki to docs directory"> + <javac srcdir="docs" destdir="docs" + debug="${compile.debug}" + deprecation="${compile.deprecation}" + optimize="${compile.optimize}"/> <!-- use wget version 1.9 or higher --> <!-- keep files: convFiles.java, style.css, README.txt !!! --> + <echo>Loading pages from Wiki ...</echo> <exec executable="wget" dir="docs"> <arg line="-q -r -l 2 -nd -E -k -p -nc -R 'index.php*' -R 'Talk:*' -R 'Image:*' -R 'Help:*' -R 'CobricksWiki:*' -R 'Special:*' http://131.159.24.138/wiki/mw/index.php/Main_Page" /> </exec> |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:16:57
|
Update of /cvsroot/cobricks/cobricks2/web/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6993/item Modified Files: item.html.en Log Message: Index: item.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/item/item.html.en,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- item.html.en 23 Jan 2006 15:13:39 -0000 1.3 +++ item.html.en 16 Feb 2006 15:16:49 -0000 1.4 @@ -44,10 +44,16 @@ #set ($itemtemplate = $itemPresenter.getItemTemplate("details", $item)) #if ($itemtemplate != "") +<!-- Item template name = $itemtemplate --> +<p> + #parse ( $itemtemplate ) #else +<!-- No item template --> +<p> + ## default item display (if no special display was defined in the ## properties @@ -124,7 +130,7 @@ #end <br/> #elseif($updatetime) - This item was last updated at $format.format($updatetime)<br/><br/> + This item was last updated at $format.format($updatetime)<br/> #end <p>Categories, this item is assigned to: @@ -151,6 +157,7 @@ ## Print all standard attributes #if($standardAttrs) <hr/><h3>All standard attributes:</h3> +</p> $itemPresenter.printAttrs($standardAttrs, $map.get("ontClass"), $language) #end <br/> |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:16:57
|
Update of /cvsroot/cobricks/cobricks2/web/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6993/user Modified Files: user-interests.html.en Log Message: Index: user-interests.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/user/user-interests.html.en,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- user-interests.html.en 5 Jul 2005 05:35:35 -0000 1.5 +++ user-interests.html.en 16 Feb 2006 15:16:49 -0000 1.6 @@ -83,7 +83,7 @@ <tr bgcolor="dfdfdf"> <td align="center"><input type="checkbox" name="id" value="$i.getId()"></td> <td>$i.getTitle()</td> - <td>$i.getCategoryClass() </td> + <td>$i.getOntologyClassName() </td> </tr> #end #else |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:16:57
|
Update of /cvsroot/cobricks/cobricks2/web/message In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6993/message Modified Files: index.html.en message.html.en subscrnew-conditions.html.en subscrnew.html.en Log Message: Index: index.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/message/index.html.en,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- index.html.en 29 Nov 2005 07:14:46 -0000 1.3 +++ index.html.en 16 Feb 2006 15:16:49 -0000 1.4 @@ -56,10 +56,17 @@ </form> -<p><a href="send.html">Send Message</a> +<p><a href="send.html">Send new Message to other User</a> -<p><a href="subscriptions.html">Show and Update Subscriptions</a> - -<a href="">Show and Update Message Filters</a> +<h3>Subscriptions</h3> + +<p>Messages (or emails) can be created automatically based on +component events from different components (which are created when +items or user objects are created or updated). To define rules for +such notification messages/emails please edit your subscriptions.</p> + +<p><form action="subscriptions.html"> <input type="submit" +class="submit" value="Show and Update Subscriptions"> </form> #end Index: subscrnew.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/message/subscrnew.html.en,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- subscrnew.html.en 7 Dec 2005 14:02:27 -0000 1.3 +++ subscrnew.html.en 16 Feb 2006 15:16:49 -0000 1.4 @@ -63,11 +63,20 @@ </tr> <tr> <td>Channelname</td> -<td><input type="text" name="channelname" size="30"></td> +<td> +<select size="1" name="channelname"> +<option value="email">email</option> +<option value="mailbox">mailbox</option> +<option value="event">event</option> +<option value="newsletterd">newsletterd</option> +<option value="newsletterw">newsletterw</option> +</select> +</td> </tr> <tr> <td>Templatename</td> -<td><input type="text" name="templatename" size="30"></td> +<td><input type="text" name="templatename" size="30"><br> +e.g. item.txt, user.txt, itemshort.txt</td> </tr> </table> <p> Index: message.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/message/message.html.en,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- message.html.en 29 Nov 2005 07:14:46 -0000 1.1 +++ message.html.en 16 Feb 2006 15:16:49 -0000 1.2 @@ -28,11 +28,13 @@ #set ( $username = "$user.getName() ($user.getUserLogin())" ) #end -$m.getSubject()<br> +<b>$m.getSubject()</b><br> by $username, $portalPresenter.formatDate($m.getSendDate()), expires $portalPresenter.formatDate($m.getExpirationDate()) <p> +<pre> $m.getContent() +</pre> #end Index: subscrnew-conditions.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/message/subscrnew-conditions.html.en,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- subscrnew-conditions.html.en 7 Dec 2005 14:02:26 -0000 1.3 +++ subscrnew-conditions.html.en 16 Feb 2006 15:16:49 -0000 1.4 @@ -12,8 +12,14 @@ <ul> <li>for items: <ul> - <li>category.id=X - <li>category.id in user.interests + <li>item.categories.id=X + <li>item.categories in thisuser.interests.categories + </ul> +<p> +<li>for users: + <ul> + <li>user.id=X + <li>user in thisuser.pim.network.buddylist </ul> <p> <li>for categories: @@ -23,7 +29,7 @@ </ul> More than one conditions can be separated by ";" - they are combined -using a "or" combination. +using an "or" combination. #parse ( "pagefooter.html" ) |
|
From: Michael K. <ko...@us...> - 2006-02-15 13:56:53
|
Update of /cvsroot/cobricks/cobricks2/conf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8924 Added Files: velocity.properties Log Message: --- NEW FILE: velocity.properties --- # logging runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem runtime.log.logsystem.log4j.category=org.cobricks.portal.velocity runtime.log.invalid.references=false # portal manager resource loader for loading templates from the # webspace (file system or database) resource.loader=portal portal.resource.loader.description= portal.resource.loader.class=org.cobricks.portal.velocity.PortalResourceLoader portal.resource.loader.cache=false portal.resource.loader.modificationCheckInterval=0 velocimacro.library=velocity.macro.library.vm |
|
From: jiang <jia...@us...> - 2006-02-13 23:33:38
|
Update of /cvsroot/cobricks/cobricks2/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13679/web Modified Files: pageheader.html Log Message: add link to agent Index: pageheader.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/pageheader.html,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pageheader.html 16 Jan 2006 20:59:37 -0000 1.16 +++ pageheader.html 13 Feb 2006 23:33:29 -0000 1.17 @@ -42,7 +42,8 @@ <a href="$contextPath/context/index.html">CONTEXT</a> | <a href="$contextPath/message/index.html">MESSAGE</a> | <a href="$contextPath/course/index.html">COURSE</a> | -<a href="$contextPath/portal/index.html">PORTAL</a> +<a href="$contextPath/portal/index.html">PORTAL</a> | +<a href="$contextPath/agent/index.html">AGENT</a> </font> </td> </tr> |
|
From: jiang <jia...@us...> - 2006-02-13 21:07:50
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25459/src/org/cobricks/item Modified Files: Item.java Log Message: update Item.java Index: Item.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/Item.java,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- Item.java 16 Jan 2006 09:23:44 -0000 1.49 +++ Item.java 13 Feb 2006 21:07:42 -0000 1.50 @@ -828,7 +828,7 @@ * Adds an ItemAnnotation to the Item * @param ia - an ItemAnnotation */ - protected void addItemAnnotation(ItemAnnotation ia) + public void addItemAnnotation(ItemAnnotation ia) { annotations.put(Integer.toString(ia.getId()), ia); } |
|
From: jiang <jia...@us...> - 2006-02-13 20:57:04
|
Update of /cvsroot/cobricks/cobricks2/web/WEB-INF/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21859/web/WEB-INF/lib Added Files: drools-java-2.1.jar drools-core-2.1.jar drools-base-2.1.jar drools-smf-2.1.jar drools-io-2.1.jar Log Message: new drools library --- NEW FILE: drools-core-2.1.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: drools-io-2.1.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: drools-base-2.1.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: drools-java-2.1.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: drools-smf-2.1.jar --- (This appears to be a binary file; contents omitted.) |
|
From: jiang <jia...@us...> - 2006-02-13 14:53:13
|
Update of /cvsroot/cobricks/cobricks2/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21040/docs Added Files: Main_Page_with_Agent.htm Log Message: Mein Page with Agent --- NEW FILE: Main_Page_with_Agent.htm --- (This appears to be a binary file; contents omitted.) |
|
From: jiang <jia...@us...> - 2006-02-13 14:52:14
|
Update of /cvsroot/cobricks/cobricks2/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20671/docs Added Files: Agent_Rule_update.jpg Agent_create_action.jpg Agent_doc.htm Agent_Rules_delete.mht Agent_Regel.jpg Angent_Rule_flow.jpg Agent_Rules_search.mht Agent_Rule_classdiagram.jpg Agent_Rules_create.mht Agent_RelationsDiagram.jpg Log Message: Agent Doc --- NEW FILE: Agent_RelationsDiagram.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_Rules_delete.mht --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_Rule_classdiagram.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Angent_Rule_flow.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_doc.htm --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_Regel.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_Rules_search.mht --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_Rules_create.mht --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_Rule_update.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Agent_create_action.jpg --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/cobricks/cobricks2/web/agent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5173/web/agent Added Files: updateRules.html index.html.en searchRules.html updateRules2.html deleteRules.html addConditions.html completeRule.html addRule.html createRule.html succ.html searchRules2.html Log Message: Agent Web --- NEW FILE: completeRule.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) $agentPresenter.disp_Rule() $agentPresenter.textFieldToHTML($result) $agentPresenter.addResultFromEdit($result) <input type="hidden" name="flag" value="true"> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: updateRules2.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a> - <a href="updateRules.html">Update Rules</a></em> <h1>Cobricks-2 - Rules Updating</h1> #if($submit=="update this condition") $agentPresenter.updateConditionOfRule($userId,$ruleid,$conid,$domain,$action,$creator,$sourceCom,$field1,$con1,$value1,$field2,$con2,$value2,$field3,$con3,$value3,$field4,$con4,$value4,$field5,$con5,$value5) #end #if($submit=="sendmail") $agentPresenter.updateActionEmailofRule($userId,$ruleid,$acID,$toUser,$subject,$TArea) #end #if($submit=="updateMsg") #if(($agentPresenter.userExist($toUser)==true)&&($agentPresenter.isInteger($priority)==true)) $agentPresenter.updateActionMessageToRule($userId,$ruleid,$acID,$toUser,$priority,$subject,$TArea) #else $agentPresenter.judge($agentPresenter.userExist($toUser),$agentPresenter.isInteger($priority)) #end #end #if($submit=="sendAnno") $agentPresenter.updateActionAnnotationToRule($userId,$ruleid,$acID,$title,$content,$rating,$language) #end #if($submit=="sendAttr") #if(($agentPresenter.domainCheck($objectName)==true)&&(($agentPresenter.isInteger($object)==true)||($agentPresenter.objectIsEmpty($object)==true))) $agentPresenter.updateActionAttributeToRule($userId,$ruleid,$acID,$objectName,$objectID,$aName,$value) #else #if($agentPresenter.domainCheck($objectName)==false) $agentPresenter.domainCheck($objectName) $agentPresenter.judgeDomain($agentPresenter.domainCheck($objectName)) #else $agentPresenter.judge($agentPresenter.isInteger($objectID),true) #end #end #end #if($submit=="sendRat") #if($agentPresenter.isInteger($rating)==true) $agentPresenter.updateActionRatingToRule($userId,$ruleid,$acID,$rating) #else $agentPresenter.judge($agentPresenter.isInteger($rating),true) #end #end #if($submit=="empty") $agentPresenter.showUpdateRule($userId,$update) #else $agentPresenter.showUpdateRule($userId,$ruleid) #end <table><tr> <input type="hidden" name="_languages" value="${lg}"/> <input type="hidden" name="agentclass" value="${agentclass}"/> <input type="hidden" name="cmd" value="searchRules"/> <input type="hidden" name="cmd.success" value="$contextPath/agent/updateRules.html"/> <input type="hidden" name="cmd.error" value="$contextPath/agent/updateRules.html"/> <input type="hidden" name="cmd.noaccess" value="$contextPath/noaccess.html"/> </tr> </table> </p> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: index.html.en --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a></em> <h1>Agent Component</h1> <!--The Item Component is responsible for managing item data objects. As all Cobricks data objects, item data objects are defined based on item classes. The <a href="$contextPath/ADMIN/org.cobricks.Agent/ontology.html">available item classes</a> can be accessed in the Item Component Admin user interface.--> <input type="hidden" name="select" value="true"> <h3><a href="createRule.html?flag=true">Create new Rules</a></h3> <h3><a href="searchRules.html">Search Rules</a></h3> <h3><a href="updateRules.html">Update Rules</a></h3> <h3><a href="deleteRules.html">Delete Rules</a></h3> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: searchRules.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a> - <a href="searchRules.html">Search Rules</a></em> #set ( $auserlogin = "$!auserlogin" ) #if ( $auserlogin == "" ) #set ( $auserlogin = $userLogin ) #end #set ( $auserid = $userManager.getUserIdForUserLogin($auserlogin) ) #set ($auser = $userManager.getUser($auserid)) #set ($auserclass = $auser.getUserClass() ) <h1>Cobricks-2 - Rules Searching</h1> #set ( $auth = $agentPresenter.checkPermission($userId) ) #if ( $auth != "true" ) <div class="error">You do not have the access permission to create a rule of user "$auserlogin".</div> <p> Please log in as user with the specified permission or ask the platform administrator to assign the permission to your account. #else $agentPresenter.getRulesForUser($userId) <table><tr> <input type="hidden" name="_languages" value="${lg}"/> <input type="hidden" name="agentclass" value="${agentclass}"/> <input type="hidden" name="cmd" value="searchRules"/> <input type="hidden" name="cmd.success" value="$contextPath/agent/searchRules.html"/> <input type="hidden" name="cmd.error" value="$contextPath/agent/searchRules.html"/> <input type="hidden" name="cmd.noaccess" value="$contextPath/noaccess.html"/> </tr> </table> </p> </form> #end $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: succ.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) $agentPresenter.addRuleToDB($userId) $agentPresenter.disp_Rule() $agentPresenter.initRule() $agentPresenter.successfull() $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: addConditions.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) #set ($result=$agentPresenter.getResultType()) #set ($fl="1") #if ( $result=="Send Email" ) $agentPresenter.addActionEmailToRule($toUser,$subject,$TArea) $agentPresenter.addRuleToDB($userId) #end #if ( $result=="Send Message" ) #if(($agentPresenter.userExist($toUser)==true)&&($agentPresenter.isInteger($priority)==true)) $agentPresenter.addActionMessageToRule($toUser,$priority,$subject,$TArea) $agentPresenter.addRuleToDB($userId) #else $agentPresenter.judge($agentPresenter.userExist($toUser),$agentPresenter.isInteger($priority)) #end #end #if ( $result=="Set Attribute" ) #if(($agentPresenter.domainCheck($objectName)==true)&&(($agentPresenter.isInteger($object)==true)||($agentPresenter.objectIsEmpty($object)==true))) $agentPresenter.addActionAttributeToRule($objectName,$objectID,$aName,$value) $agentPresenter.addRuleToDB($userId) #else #if($agentPresenter.domainCheck($objectName)==false) $agentPresenter.domainCheck($objectName) $agentPresenter.judgeDomain($agentPresenter.domainCheck($objectName)) #else $agentPresenter.judge($agentPresenter.isInteger($objectID),true) #end #end #end #if ( $result=="Set Annotation" ) $agentPresenter.addActionAnnotationToRule($title,$content,$rating,$language) $agentPresenter.addRuleToDB($userId) #end #if ( $result=="Set Rating" ) #if($agentPresenter.isInteger($annoID)==true) $agentPresenter.addActionRatingToRule($annoID,$rating) $agentPresenter.addRuleToDB($userId) #else $agentPresenter.judge($agentPresenter.isInteger($annoID),true) #end #end #if($agentPresenter.judge($result)) $agentPresenter.judge($agentPresenter.judge($result),true) #end $agentPresenter.disp_Rule() $agentPresenter.initRule() <h2>userId is:</h2> $userId <form action="addRule.html" method="post" > <h1><i>I don't want to add any other condition.</i></h1><br> <input type="submit" name=complete value="Click here to complete this rule"> <input type="hidden" name=ruleflag value=true> </form> <form action="completeRule.html" method="post"> <h2>result:</h2> <select name=result> <option>Send Email <option>Send Message <option>Set Attribute <option selected>Set Annotation <option>Set Rating </select><p> <table> <tr> <td><input type="submit" value="Add Rule"/></td> <input type="hidden" name="flag" value="true"> </tr></table> </form> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: addRule.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) #set ($result=$agentPresenter.getResultType()) #set ($fl="1") #if ( $result=="Send Email" ) $agentPresenter.addActionEmailToRule($toUser,$subject,$TArea) #if($ruleflag=="false") $agentPresenter.addNewAction() #end #end #if ( $result=="Send Message" ) #if(($agentPresenter.userExist($toUser)==true)&&($agentPresenter.isInteger($priority)==true)) $agentPresenter.addActionMessageToRule($toUser,$priority,$subject,$TArea) #if($ruleflag=="false") $agentPresenter.addNewAction() #end #else $agentPresenter.judge($agentPresenter.userExist($toUser),$agentPresenter.isInteger($priority)) #end #end #if ( $result=="Set Attribute" ) #if(($agentPresenter.domainCheck($objectName)==true)&&(($agentPresenter.isInteger($object)==true)||($agentPresenter.objectIsEmpty($object)==true))) $agentPresenter.addActionAttributeToRule($objectName,$objectID,$aName,$value) #if($ruleflag=="false") $agentPresenter.addNewAction() #end #else #if($agentPresenter.domainCheck($objectName)==false) $agentPresenter.domainCheck($objectName) $agentPresenter.judgeDomain($agentPresenter.domainCheck($objectName)) #else $agentPresenter.judge($agentPresenter.isInteger($objectID),true) #end #end #end #if ( $result=="Set Annotation" ) $agentPresenter.addActionAnnotationToRule($title,$content,$rating,$language) #if($ruleflag=="false") $agentPresenter.addNewAction() #end #end #if ( $result=="Set Rating" ) #if($agentPresenter.isInteger($rating)==true) $agentPresenter.addActionRatingToRule($rating) #if($ruleflag=="false") $agentPresenter.addNewAction() #end #else $agentPresenter.judge($agentPresenter.isInteger($rating),true) #end #end #if($agentPresenter.judge($result)) $agentPresenter.judge($agentPresenter.judge($result),true) #end $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: updateRules.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a> - <a href="updateRules.html">Update Rules</a></em> #set ( $auserlogin = "$!auserlogin" ) #if ( $auserlogin == "" ) #set ( $auserlogin = $userLogin ) #end #set ( $auserid = $userManager.getUserIdForUserLogin($auserlogin) ) #set ($auser = $userManager.getUser($auserid)) #set ($auserclass = $auser.getUserClass() ) <h1>Cobricks-2 - Rules Updating</h1> #set ( $auth = $agentPresenter.checkPermission($userId) ) #if ( $auth != "true" ) <div class="error">You do not have the access permission to create a rule of user "$auserlogin".</div> <p> Please log in as user with the specified permission or ask the platform administrator to assign the permission to your account. #else $agentPresenter.getRulesForUserUpdate($userId) </p> </form> #end $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: deleteRules.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a> - <a href="deleteRules.html">Delete Rules</a></em> #set ( $auserlogin = "$!auserlogin" ) #if ( $auserlogin == "" ) #set ( $auserlogin = $userLogin ) #end #set ( $auserid = $userManager.getUserIdForUserLogin($auserlogin) ) #set ($auser = $userManager.getUser($auserid)) #set ($auserclass = $auser.getUserClass() ) <h1>Cobricks-2 - Rules Deletion</h1> #set ( $auth = $agentPresenter.checkPermission($userId) ) #if ( $auth != "true" ) <div class="error">You do not have the access permission to create a rule of user "$auserlogin".</div> <p> Please log in as user with the specified permission or ask the platform administrator to assign the permission to your account. #else $agentPresenter.delRulesForUser($userId) <table><tr> <input type="hidden" name="_languages" value="${lg}"/> <input type="hidden" name="agentclass" value="${agentclass}"/> <input type="hidden" name="cmd" value="searchRules"/> <input type="hidden" name="cmd.success" value="$contextPath/agent/deleteRules.html"/> <input type="hidden" name="cmd.error" value="$contextPath/agent/deleteRules.html"/> <input type="hidden" name="cmd.noaccess" value="$contextPath/noaccess.html"/> </tr> </table> </p> </form> #end $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: createRule.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a> - <a href="createRules.html">Create Rules</a></em> #set ( $auserlogin = "$!auserlogin" ) #if ( $auserlogin == "" ) #set ( $auserlogin = $userLogin ) #end #set ( $auserid = $userManager.getUserIdForUserLogin($auserlogin) ) #set ($auser = $userManager.getUser($auserid)) #set ($auserclass = $auser.getUserClass() ) <h1>Cobricks-2 - Rules Creation</h1> #set ( $auth = $agentPresenter.checkPermission($userId) ) #if ( $auth != "true" ) <div class="error">You do not have the access permission to create a rule of user "$auserlogin".</div> <p> Please log in as user with the specified permission or ask the platform administrator to assign the permission to your account. #else <b><h2>List of all conditions:</h2></b> $agentPresenter.initRule($flag) $agentPresenter.addFromEdit($domain,$action,$creator,$sourcecomponent,$field1,$con1,$value1,$field2,$con2,$value2,$field3,$con3,$value3,$field4,$con4,$value4,$field5,$con5,$value5) <table border><tr><th><h3>domain</h3></th><th><h3>action</h3></th><th><h3>operator</h3></th><th><h3>source component</h3></th><th><h3>attribute</h3></th> $agentPresenter.disp_array() </table border> <form action="createRule.html" method="get"> <table > <tr valign="top"> <td> <h2>domain:</h2> </td><td> <select name=domain> <option>item <option selected>context <option>category <option>course <option>portal </select> </td> </tr> <tr valign="top"> <td> <h2>action:</h2> </td><td> <select name=action> <option>create <option selected>delete <option>update </select> </td> <tr valign="top"> <td> <h2>operator:</h2> </td><td> <input type=text name=creator size="25"> </td> </tr> <tr valign="top"> <td> <h2>sourcecomponent:</h2> </td><td> <select name=sourcecomponent> <option>org.cobricks.item <option selected>org.cobricks.context <option>org.cobricks.category <option>org.cobricks.course <option>org.cobricks.portal </select> </td> </tr> </table> <table> <tr> <td> <h2>Set attributes value:</h2> <table cellspacing="10" height="213"> <tr valign="top"> <td height="34"><b>Attribute name</b></td> <td height="34"><input type=text name=field1></td> <td height="34"> <select name=con1> <option>like <option selected>= <option>< <option>> </select> </td> <td height="34"><b>Attribute value</b></td> <td height="34"><input type=text name=value1></td> </tr> <tr valign="top"> <td height="34"><b>Attribute name</b></td> <td height="34"><input type=text name=field2></td> <td height="34"> <select name=con2> <option>like <option selected>= <option>< <option>> </select> </td> <td height="34"><b>Attribute value</b></td> <td height="34"><input type=text name=value2></td> </tr> <tr valign="top"> <td height="34"><b>Attribute name</b></td> <td height="34"><input type=text name=field3></td> <td height="34"> <select name=con3> <option>like <option selected>= <option>< <option>> </select> </td> <td height="34"><b>Attribute value</b></td> <td height="34"><input type=text name=value3></td> </tr> <tr valign="top"> <td height="34"><b>Attribute name</b></td> <td height="34"><input type=text name=field4></td> <td height="34"> <select name=con4> <option>like <option selected>= <option>< <option>> </select> </td> <td height="34"><b>Attribute value</b></td> <td height="34"><input type=text name=value4></td> </tr> <tr valign="top"> <td height="17"><b>Attribute name</b></td> <td height="17"><input type=text name=field5></td> <td height="17"> <select name=con5> <option>like <option selected>= <option>< <option>> </select> </td> <td height="17"><b>Attribute value</b></td> <td height="17"><input type=text name=value5></td> </tr> </table> </td> </tr> </table> <input type="hidden" name="flag" value="false"> <br> <br> <table> <tr> <td><input type="submit" value="Add Condition"/></td> <td><input type="reset" value="Reset Condition"/></td> </tr></table> <hr> </form> <form action="completeRule.html" method="post"> <br> <h2>result:</h2> <select name=result> <option>Send Email <option>Send Message <option>Set Attribute <option selected>Set Annotation <option>Set Rating </select> <input type="submit" value="Add Action"/><p> <table> <tr> <td></td> <input type="hidden" name="flag" value="true"> </tr></table> <table> <tr> <input type="hidden" name="_languages" value="${lg}"/> <input type="hidden" name="agentclass" value="${agentclass}"/> <input type="hidden" name="cmd" value="createRules"/> <input type="hidden" name="cmd.success" value="$contextPath/agent/createRules.html"/> <input type="hidden" name="cmd.error" value="$contextPath/agent/createRules.html"/> <input type="hidden" name="cmd.noaccess" value="$contextPath/noaccess.html"/> </tr></table> </form> #end $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: searchRules2.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Agent Component</a> - <a href="searchRules.html">Search Rules</a></em> <h1>Cobricks-2 - Rules Searching</h1> <form action="$contextPath/AGENT" method="post" enctype="multipart/form-data"> #set($request=$portalRequest.getHttpServletRequest()) #set($map=$request.getParameterMap()) <br> #set($deleteSet=$agentPresenter.getDeleteValues($map)) #set($result=$agentPresenter.deleteRulefromDB($userId,$deleteSet)) #if($result==true) <h2>Rules $deleteSet deleted.</h2> #else <h2>No rules could be deleted.</h2> #end <table><tr> <input type="hidden" name="_languages" value="${lg}"/> <input type="hidden" name="agentclass" value="${agentclass}"/> <input type="hidden" name="cmd" value="searchRules"/> <input type="hidden" name="cmd.success" value="$contextPath/agent/searchRules.html"/> <input type="hidden" name="cmd.error" value="$contextPath/agent/searchRules.html"/> <input type="hidden" name="cmd.noaccess" value="$contextPath/noaccess.html"/> </tr> </table> </p> </form> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) |
|
From: jiang <jia...@us...> - 2006-02-13 12:44:08
|
Update of /cvsroot/cobricks/cobricks2/web/agent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5121/web/agent Log Message: Directory /cvsroot/cobricks/cobricks2/web/agent added to the repository |
|
From: jiang <jia...@us...> - 2006-02-13 12:37:24
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/agent/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2933/src/org/cobricks/agent/db Added Files: user_rulesactions.xml user_rules.xml user_rulesconditions.xml tables.txt Log Message: Agent Component --- NEW FILE: user_rules.xml --- <tabledescriptor tablename="user_rules"> <table version="1"> <tablelayout> <column name="ruleID" type="int" primarykey="true"/> <column name="userID" type="int" notnull="true"/> <index name="rules_userID"> <colname>userID</colname> </index> </tablelayout> </table> </tabledescriptor> --- NEW FILE: tables.txt --- user_rules user_rulesactions user_rulesconditions --- NEW FILE: user_rulesactions.xml --- <tabledescriptor tablename="user_rulesactions"> <table version="1"> <tablelayout> <column name="rule_actionID" type="int" primarykey="true"/> <column name="ruleID" type="int" notnull="true"/> <column name="rule_action" type="varchar(255)" notnull="true"></column> <column name="message" type="CLOB"></column> <index name="rulesactions_ruleID"> <colname>ruleID</colname> </index> </tablelayout> </table> </tabledescriptor> --- NEW FILE: user_rulesconditions.xml --- <tabledescriptor tablename="user_rulesconditions"> <table version="1"> <tablelayout> <column name="rule_conditionID" type="int" primarykey="true"/> <column name="ruleID" type="int" notnull="true"/> <column name="rule_condition" type="varchar(255)" notnull="true"></column> <index name="rulesconditions_ruleID"> <colname>ruleID</colname> </index> </tablelayout> </table> </tabledescriptor> |
|
From: jiang <jia...@us...> - 2006-02-13 12:37:24
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/agent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2933/src/org/cobricks/agent Added Files: Attribute.java AgentManagerImpl.java properties.txt ActionRating.java ActionSendMail.java Agent.java AgentManager.java Condition.java ActionSendMsg.java Rule.java DRLCreator.java AgentServlet.java ActionAnnotation.java Action.java ActionSetAttr.java AgentPresenter.java Log Message: Agent Component --- NEW FILE: AgentPresenter.java --- /* * Copyright (c) 2004-2005 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 org.cobricks.agent; import java.io.File; import java.io.InputStream; import java.sql.Timestamp; import java.text.DateFormat; [...1533 lines suppressed...] return sh.toString(); } public final String addNewAction() { StringBuffer add=new StringBuffer("<form action='succ.html' method=post >"); add.append("<br><br><br><h1>To finish this rule:</h1>"); add.append("<input type=submit name=complete value='Click here to complete this rule'> "); add.append("<input type=hidden name=ruleflag value=true></form>"); add.append("<form action=completeRule.html method=post>"); add.append("<br><br><h1>To add more actions:</h1><br>"); add.append(" <h2>result:</h2><select name=result><option>Send Email <option>Send Message <option>Set Attribute <option selected>Set Annotation <option>Set Rating </select><p>"); add.append(" <table><tr><td><input type=submit value='Add Action'/></td>"); add.append(" <input type=hidden name=ruleflag value=false></form>"); add.append(" <input type=hidden name=flag value=true></tr></table></form>"); return add.toString(); } } --- NEW FILE: ActionSetAttr.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class ActionSetAttr extends Action { private String objectName; private int objectID; private String aName; private String aValue; public ActionSetAttr(){ type = Action.SETATTR; } public ActionSetAttr(String oName, int oID, String name, String value){ this(); objectName = oName; objectID = oID; aName = name; aValue = value; } // attrFromDB: UPDATE <objectName> <objectID> SET <aName>=<aValue> public ActionSetAttr(int actionID, String attrFromDB){ this.actionID = actionID; String[] strs = attrFromDB.split(" |="); objectName = strs[1]; objectID = Integer.parseInt(strs[2].trim()); aName = strs[4]; aValue = strs[5]; //TODO } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { String result = "UPDATE "+ objectName +" "+objectID+" SET " + aName+ "="+aValue; return result; } /* (non-Javadoc) * @see org.cobricks.agent.Action#toHtmlString() */ public String toHtmlString() { // TODO Auto-generated method stub return null; } public String getAName() { return aName; } public void setAName(String name) { aName = name; } public String getAValue() { return aValue; } public void setAValue(String value) { aValue = value; } public int getObjectID() { return objectID; } public void setObjectID(int objectID) { this.objectID = objectID; } public String getObjectName() { return objectName; } public void setObjectName(String objectName) { this.objectName = objectName; } } --- NEW FILE: ActionSendMsg.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class ActionSendMsg extends Action { private int toUserID; // Das Attribut toSelf ist ¨¹berfl¨¹?ig. //private boolean toSelf; private int priority; private String subject; public ActionSendMsg(){ type = Action.SENDMSG; priority = -1; } public ActionSendMsg(int userID, int pri, String subj, String cont){ this(); toUserID = userID; priority = pri; content = cont; subject=subj; } /** * format of msgFromDB: Send Message:<toUserID>:<priority>:<subject> * * @param actionID : id of the action in the database * @param msgFromDB: action descreption * @param content: message content */ public ActionSendMsg(int actionID, String msgFromDB, String content){ this.actionID = actionID; String[] strs = msgFromDB.split(":"); toUserID =Integer.parseInt( strs[1]); priority = Integer.parseInt(strs[2]); subject=strs[3]; this.content = content; } /** * format: Send Message:<toUserID>:<priority>:<subject> */ public String toString() { StringBuffer result = new StringBuffer("Send Message:"); result.append(toUserID+":"); result.append(priority+":"); if (subject == null || subject.equals("")) result.append("No subject"); else result.append(subject); return result.toString(); } /* (non-Javadoc) * @see org.cobricks.agent.Action#toHtmlString() */ public String toHtmlString() { // TODO Auto-generated method stub return null; } /** * @return Returns the priority. */ public int getPriority() { return priority; } /** * @param priority The priority to set. */ public void setPriority(int priority) { this.priority = priority; } /** * @return Returns the toUserID. */ public int getToUserID() { return toUserID; } /** * @param toUserID The toUserID to set. */ public void setToUserID(int toUserID) { this.toUserID = toUserID; } /** * @return Returns the subject. */ public String getSubject(){ return subject; } /** * @param subject The subject to set. */ public void setSubject(String subject){ this.subject=subject; } } --- NEW FILE: ActionRating.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; import java.util.ArrayList; import java.util.Iterator; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class ActionRating extends Action { private int annoID; private String rating; public ActionRating(){ this.type = Action.SETRAT; } /* public ActionSendMail(String et, String subj, String cont){ this(); emailTo = et; subject = subj; content = cont; } */ // Format of mailFromDB: Set Rating:<annoID>:<rating> public ActionRating(int actionID, String ratFromDB){ this.actionID = actionID; String[] cont = ratFromDB.split(":",3); annoID = Integer.parseInt(cont[1]); rating = cont[2]; } /* * @see java.lang.Object#toString() */ public String toString() { StringBuffer result = new StringBuffer("Set Rating:"); result.append(annoID+":"); result.append(rating); return result.toString(); } /** * the output html format for Velocity template * * @see org.cobricks.agent.Action#toHtmlString() * @return the output html format for Velocity template (Ye Shen) * */ public String toHtmlString() { // TODO Auto-generated method stub return null; } /** * @return Returns the subject. */ public int getAnnoID() { return annoID; } /** * @param subject The subject to set. */ public void setAnnoID(int annoID) { this.annoID = annoID; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } } --- NEW FILE: AgentManager.java --- /* * Copyright (c) 2005 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 org.cobricks.agent; import java.util.List; import org.cobricks.core.ComponentManagerInterface; /** * Interface of the manager class of the Message Component. * * @author mic...@ac... * @version $Date: 2006/02/13 12:37:05 $ */ public interface AgentManager extends ComponentManagerInterface { public void obtainRules(); public void insertRuleForUser(int userID, Rule rule); public void delRule(int userID, Rule rule); public void updateRule(int userID, Rule rule); public List getRulesForUser(int userID); } --- NEW FILE: Condition.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; import java.util.HashMap; import java.util.Iterator; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class Condition { private int conditionID; private String domain; private String action; private int userID; private String srcComponent; HashMap attrMap = new HashMap(); public Condition(){ attrMap = new HashMap(); } /** Get a condition from database * //Condition format: * <domain>:<action>:<userID>:<srcComponent>:{<aname>=|<|>|~<avaule>;}* * The character ~ stands for like * @param conditionID : the column rule_conditionID from table user_rulesConditions * @param conFromDB : the column rule_condition from table user_rulesConditions */ public Condition(int conditionID,String conFromDB){ this(conFromDB); this.conditionID = conditionID; } // Get a condition from database public Condition(String conFromDB){ String[] content = conFromDB.split(":"); domain = content[0]; System.out.println(domain); action = content[1]; System.out.println(action); userID = Integer.parseInt(content[2]); System.out.println(userID); srcComponent = content[3]; System.out.println(srcComponent); attrMap = new HashMap(); if (content.length==4) return; System.out.println(content[4]); String[] attrPaars = content[4].split(";"); System.out.println(attrPaars.length); System.out.println(attrPaars[0]); System.out.println(attrPaars[1]); for (int attIndex = 0; attIndex <attrPaars.length; attIndex++){ int type; if (attrPaars[attIndex].indexOf("=")> -1) type = Attribute.EQUAL; else if (attrPaars[attIndex].indexOf(">")> -1) type = Attribute.GREATER; else if (attrPaars[attIndex].indexOf("<")>-1) type = Attribute.SMALLER; else if (attrPaars[attIndex].indexOf("~")> -1) type = Attribute.LIKE; else continue; System.out.println(type); String[] attrPaar = attrPaars[attIndex].split("=|>|<|~"); System.out.println("attrpaar lentt"+attrPaar.length+attrPaar[0]); Attribute attr = new Attribute(attrPaar[0], type, attrPaar[1]); System.out.println(attr); attrMap.put(attrPaar[0], attr); } } // Get a condition from the Browser. Attention: we obtain the conditionID from the database. The value is // equivalent to the maximal ID in the table condition. public Condition(String d, String o, int userid, String s){ domain=d; srcComponent=s; userID= userid; action=o; } /** * <domain>:<action>:<userID>:<srcComponent>:{<aname>=<avaule>;}* * @return Returns the output for database. Save a condition into the database */ public String toString(){ StringBuffer result = new StringBuffer(); result.append(domain+":"+action+":"+userID+":"+srcComponent); if (attrMap ==null || attrMap.isEmpty()) return result.toString(); result.append(":"); for(Iterator keys= attrMap.keySet().iterator(); keys.hasNext();){ Attribute attr= (Attribute)attrMap.get(keys.next()); result.append(attr.toString()); result.append(";"); } result.deleteCharAt(result.length()-1); return result.toString(); } /** * add the attribut for condition * * @param name name of the attribut * @param value value of the attribut */ public void addAttr(String name, int type, String value){ if (type < 0 || type >3) return; Attribute attr = new Attribute (name, type, value); attrMap.put(name, attr); } /** * delete an attribut from the condition * * @param name name of the attribut */ public void delAttr(String name){ attrMap.remove(name); } /** * change the value of an attribut * * @param name name of the attribut * @param newvalue new value of the attribut */ public void changeAttr(String name, int type, String newValue){ delAttr(name); addAttr(name,type, newValue); } /** * the output html format for Velocity template * * @return the output html format for Velocity template (Ye Shen) */ public String toHtmlString(){ // TODO Auto-generated method stub StringBuffer show=new StringBuffer("<tr>"); show.append("<td>"+domain+"</td>"); show.append("<td>"+action+"</td>"); if(userID==0) show.append("<td><color=red>operator is not defined!</color></td>"); else show.append("<td>"+userID+"</td>"); show.append("<td>"+srcComponent+"</td>"); show.append("<td><table border>"); for (Iterator keys = attrMap.keySet().iterator();keys.hasNext();){ String key = (String)keys.next(); Attribute attr= (Attribute)attrMap.get(key); show.append("<tr><td>"+key+"</td><td>"); if (attr.getType()== Attribute.EQUAL) show.append("="); else if (attr.getType()== Attribute.GREATER) show.append(">"); else if (attr.getType()== Attribute.SMALLER) show.append("<"); else show.append(" like "); show.append("</td><td>"); show.append(attr.getValue()); show.append("</td></tr>"); } show.append("</table></td></tr>"); return show.toString(); } public HashMap getAttrMap() { return attrMap; } public int getUserID() { return userID; } public void setUserID(int userID) { this.userID = userID; } /** * @return Returns the conditionID. */ public int getConditionID() { return conditionID; } /** * @param conditionID The conditionID to set. */ public void setConditionID(int conditionID) { this.conditionID = conditionID; } /** * @return Returns the domain. */ public String getDomain() { return domain; } /** * @param domain The domain to set. */ public void setDomain(String domain) { this.domain = domain; } /** * @return Returns the option. */ public String getOption() { return action; } /** * @param option The option to set. */ public void setOption(String option) { this.action = option; } /** * @return Returns the srcComponent. */ public String getSrcComponent() { return srcComponent; } /** * @param srcComponent The srcComponent to set. */ public void setSrcComponent(String srcComponent) { this.srcComponent = srcComponent; } } --- NEW FILE: DRLCreator.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; import java.util.Map; import java.util.Iterator; import java.util.List; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import org.apache.log4j.Logger; import org.cobricks.core.CoreManager; import org.cobricks.user.User; import org.cobricks.user.UserManager; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class DRLCreator { static Logger logger = Logger.getLogger(DRLCreator.class); Map totalRules; CoreManager coreManager; String DRL_dir; public DRLCreator(Map totalRules, String dir,CoreManager coreManager) { this.totalRules = totalRules; this.coreManager = coreManager; DRL_dir=dir; int key=-1; createDRL(key); } public DRLCreator(Map totalRules, String dir, int userid, CoreManager coreManager){ this.totalRules=totalRules; this.coreManager=coreManager; DRL_dir=dir; createDRL(userid); } public void createDRL(int key){ BufferedOutputStream bos; byte[] b; try { if(key==-1) bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent.java.drl"))); else bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"))); String top="<?xml version=\"1.0\"?>\n" + "<rule-set name=\"Agent\"\n" + "xmlns=\"http://drools.org/rules\"\n" + "xmlns:java=\"http://drools.org/semantics/java\"\n" + "xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "xs:schemaLocation=\"http://drools.org/rules rules.xsd\n" + "http://drools.org/semantics/java java.xsd\">\n"; b=top.getBytes(); bos.write(b); bos.close(); createDRL_function(key); Iterator iterator = totalRules.entrySet().iterator(); if(key==-1){ while(iterator.hasNext()){ List rulesForUser = (List)iterator.next(); if (rulesForUser == null || rulesForUser.isEmpty()) continue; for (int i=0; i<rulesForUser.size();i++){ Rule rule = (Rule)rulesForUser.get(i); String ru="<rule name=\""+rule.getRuleID()+"\">\n" + "<parameter identifier=\"coreManager\">\n" + "<class>CoreManager</class>\n" + "</parameter>\n" + "<parameter identifier=\"creator\">\n" + "<class>User</class>\n" + "</parameter>\n" + "<parameter identifier=\"domain\">\n" + "<class>String</class>\n" + "</parameter>\n"+ "<parameter identifier=\"opt\">\n" + "<class>String</class>\n" + "</parameter>\n"+ "<parameter identifier=\"src\">\n" + "<class>String</class>\n" + "</parameter>\n"; b=ru.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); bos.write(b); bos.close(); createDRL_rule(key, rule.getConditions(), rule.getActions()); ru="</rule>\n"; b=ru.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); bos.write(b); bos.close(); } } String end="</rule-set>"; b=end.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); bos.write(b); bos.close(); } else{ List rulesForUser = (List)totalRules.get(new Integer(key)); if (rulesForUser == null || rulesForUser.isEmpty()) logger.debug("ERROR:this user has no rules!"); else {for (int i=0; i<rulesForUser.size();i++) { Rule rule = (Rule)rulesForUser.get(i); String ru="<rule name=\""+rule.getRuleID()+"\">\n" + "<parameter identifier=\"coreManager\">\n" + "<class>CoreManager</class>\n" + "</parameter>\n" + "<parameter identifier=\"creator\">\n" + "<class>User</class>\n" + "</parameter>\n" + "<parameter identifier=\"domain\">\n" + "<class>String</class>\n" + "</parameter>\n"+ "<parameter identifier=\"opt\">\n" + "<class>String</class>\n" + "</parameter>\n"+ "<parameter identifier=\"src\">\n" + "<class>String</class>\n" + "</parameter>\n"; b=ru.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); bos.write(b); bos.close(); createDRL_rule(key, rule.getConditions(), rule.getActions()); ru="</rule>\n"; b=ru.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); bos.write(b); bos.close(); } } String end="</rule-set>"; b=end.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); bos.write(b); bos.close(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void createDRL_function(int key){ BufferedOutputStream bos; byte[] b; try { if(key==-1) bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent.java.drl"),true)); else bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); String ac= "<import>org.cobricks.user.*</import>\n" + "<import>org.cobricks.category.*</import>\n"+ "<import>org.cobricks.item.*</import>\n"+ "<import>org.cobricks.context.*</import>\n"+ "<import>org.cobricks.core.util.MailUtil</import>\n"+ "<import>org.cobricks.message.MessageManager</import>\n" + "<import>org.cobricks.message.MessageManagerImpl</import>\n" + "<import>org.cobricks.core.ComponentDirectory</import>\n" + "<import>org.cobricks.message.Message</import>\n" + "<import>org.cobricks.core.CoreManager</import>\n" + "<import>java.lang.Object</import>\n" + "<import>java.lang.String</import>\n" + "<import>java.io.IOException</import>\n"+ "<import>java.util.Date</import>\n"+ "<import>java.util.Map</import>\n"+ "<import>java.util.HashMap</import>\n"+ "<import>java.util.List</import>\n"+ "<import>java.util.Iterator</import>\n"+ "<java:functions>\n"; ac=ac+"public void sendMsg(CoreManager coreManager,User creator, int recipientID, int priority, String subject, String message_content)\n" + "{\n" + "try{\n" + "MessageManager m;\n" + "ComponentDirectory componentDirectory = coreManager.getComponentDirectory();\n" + "m= (MessageManager)componentDirectory.getManager(\"messageManager\");\n" + "Message message = new Message();\n" + "message.addRecipient(recipientID);\n" + "message.setSubject(subject);\n" + "message.setPriority(priority);\n" + "message.setContent(message_content);\n" + "m.sendMessage(message, creator);\n" + "}\n" + "catch(Exception e){\n" + "System.out.print(e.toString());\n" + "}\n" + "}\n" ; ac=ac+"public void sendEmail(CoreManager coreManager, String smtphost, String emailfrom, String emailaddr, String subject, String m)\n"+ "{\n"+ "try{\n"+ "String emailto=new String();\n"+ "if(emailaddr.split(\"@\").length==1){\n"+ "UserManager userManager = (UserManager)coreManager.getComponentDirectory().getManager(\"userManager\");\n"+ "int id=userManager.getUserIdForUserLogin(emailaddr);\n"+ "User emailtouser=userManager.getUser(id);\n"+ "emailto = emailtouser.getAttributeAsString(User.EMAIL);\n"+ "}\n"+ "else if(emailaddr.split(\"@\").length==2){\n"+ "emailto=emailaddr;"+ "}\n"+ "MailUtil.sendMail(smtphost, emailto, emailfrom, subject, m);\n"+ "}\n" + "catch(Exception e){\n" + "System.out.print(e.toString());\n" + "}\n" + "}\n"; ac=ac+"public void setAttr(CoreManager coreManager,Item item,int id, String aname, String value)"+ "{\n"+ "try{\n"+ "if(id==0){\n"+ "item.setAttribute(aname,value);\n"+ "}\n"+ "else{\n"+ "ItemManager itemManager=(ItemManager)coreManager.getComponentDirectory().getManager(\"itemManager\");\n"+ "Item item=itemManager.getItem(id);\n"+ "item.setAttribute(aname,value);\n"+ "}\n"+ "}\n" + "catch(Exception e){\n" + "System.out.print(e.toString());\n" + "}\n" + "}\n"; ac=ac+"public void setAttr(CoreManager coreManager, Category category,int id, String aname, String value)"+ "{\n"+ "try{\n"+ "if(id==0){\n"+ "id=category.getId();\n"+ "}\n"+ "else{\n"+ "CategoryManager categoryManager=(CategoryManager)coreManager.getComponentDirectory().getManager(\"categoryManager\");\n"+ "Category category=categoryManager.getCategory(id);\n"+ "category.setAttribute(aname,value);\n"+ "}\n"+ "}\n" + "catch(Exception e){\n" + "System.out.print(e.toString());\n" + "}\n" + "}\n"; ac=ac+"public void setAttr(CoreManager coreManager, Context context,int id, String aname, String value)"+ "{\n"+ "try{\n"+ "if(id==0){\n"+ "id=context.getId();\n"+ "}\n"+ "else{\n"+ "ContextManager contextManager=(ContextManager)coreManager.getComponentDirectory().getManager(\"contextManager\");\n"+ "Context context=contextManager.getContext(id);\n"+ "context.setAttribute(aname,value);\n"+ "}\n"+ "}\n" + "catch(Exception e){\n" + "System.out.print(e.toString());\n" + "}\n" + "}\n"; ac=ac+"public void setAnnotation(CoreManager coreManager, User creator, Item item, String lang, String title, String content, int rating){\n"+ "try{"+ "ItemManager itemManager=(ItemManager)coreManager.getComponentDirectory().getManager(\"itemManager\");\n"+ "int aitemid=item.getAnnotationCount()+1;\n"+ "Date datum=new Date();\n"+ "ItemAnnotation itemannotation=new ItemAnnotation(itemManager,aitemid, item.getId(), creator.getId(), datum, lang, title, content, rating);\n"+ "item.addItemAnnotation(itemannotation);\n"+ "}\n"+ "catch(Exception e){\n"+ "System.out.print(e.toString());"+ "}\n"+ "}\n"; ac=ac+"public void setRating(CoreManager coreManager, User creator, Item item, int rating)"+ "{\n"+ "try{\n"+ "setAnnotation(coreManager, creator, item, \" \",\"set Rating\",\" \",rating);\n"+ "}\n"+ "catch(Exception e){\n" + "System.out.print(e.toString());\n" + "}\n" + "}\n"; ac=ac+"</java:functions>\n"; b=ac.getBytes(); bos.write(b); bos.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void createDRL_rule(int key, List c, List a){ BufferedOutputStream bos; byte[] b; try { if(key==-1) bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent.java.drl"),true)); else bos = new BufferedOutputStream(new FileOutputStream(DRL_dir.concat("Agent_"+key+".java.drl"),true)); String ru=null; Iterator i_c=c.iterator(); while(i_c.hasNext()){ Condition condition=(Condition)i_c.next(); if(condition.getDomain().equals("item")){ ru="<parameter identifier=\"item\">\n" + "<class>Item</class>\n" + "</parameter>\n"; } if(condition.getDomain().equals("category")){ ru="<parameter identifier=\"category\">\n" + "<class>Category</class>\n" + "</parameter>\n"; } if(condition.getDomain().equals("context")){ ru="<parameter identifier=\"context\">\n" + "<class>Context</class>\n" + "</parameter>\n"; } } Iterator i_c2=c.iterator(); while(i_c2.hasNext()){ Condition condition=(Condition)i_c2.next(); ru=ru+"<java:condition>domain.equals(\""+condition.getDomain()+"\")</java:condition>\n"+ "<java:condition>src.equals(\""+condition.getSrcComponent()+"\")</java:condition>\n"; int userID=condition.getUserID(); UserManager userManager = (UserManager) coreManager.getComponentDirectory().getManager("userManager"); User user=userManager.getUser(userID); String creator; if(userID==0){ creator=""; } else creator=user.getUserLogin(); if(!creator.equals("")){ ru=ru+"<java:condition>creator.getUserLogin().equals(\""+creator+"\")</java:condition>\n"; } ru=ru+"<java:condition>opt.equals(\""+condition.getOption()+"\")</java:condition>\n"; if(condition.getAttrMap()!=null){ Map attrMap = condition.getAttrMap(); Iterator attrkey = attrMap.keySet().iterator(); while (attrkey.hasNext()){ String attr_name = (String)attrkey.next(); Attribute attr=(Attribute)attrMap.get(attr_name); if(condition.getSrcComponent().equals("org.cobricks.item")){ if(attr.getName().equals("title")){ if(attr.getType()==0) ru=ru+"<java:condition>item.getTitle().equals(\""+ attr.getValue()+"\")</java:condition>\n"; else if(attr.getType()==1) ru=ru+"<java:condition>item.getTitle().compareTo(\""+ attr.getValue()+"\")>0</java:condition>\n"; else if(attr.getType()==2) ru=ru+"<java:condition>item.getTitle().compareTo(\""+ attr.getValue()+"\")<0</java:condition>\n"; else if(attr.getType()==3){ ru=ru+"<java:condition>item.getTitle().indexOf(\""+attr.getValue()+"\")>=0"+ "</java:condition>\n"; } } else if(attr.getName().equals("content")){ if(attr.getType()==0) ru=ru+"<java:condition>item.getContent().equals(\""+ attr.getValue()+"\")</java:condition>\n"; else if(attr.getType()==1) ru=ru+"<java:condition>item.getContent().compareTo(\""+ attr.getValue()+"\")>0</java:condition>\n"; else if(attr.getType()==2) ru=ru+"<java:condition>item.getContent().compareTo(\""+ attr.getValue()+"\")<0</java:condition>\n"; else if(attr.getType()==3) ru=ru+"<java:condition>item.getContent().indexOf(\""+attr.getValue()+"\")>=0"+ "</java:condition>\n"; } else { if(attr.getType()==0) ru=ru+"<java:condition>item.getAttributeAsString(\""+attr.getName()+"\").equals(\""+ attr.getValue()+"\")</java:condition>\n"; else if(attr.getType()==1) ru=ru+"<java:condition>item.getAttributeAsString(\""+attr.getName()+"\").compareTo(\""+ attr.getValue()+"\")>0</java:condition>\n"; else if(attr.getType()==2) ru=ru+"<java:condition>item.getAttributeAsString(\""+attr.getName()+"\").compareTo(\""+ attr.getValue()+"\")<0</java:condition>\n"; else if(attr.getType()==3) ru=ru+"<java:condition>item.getAttributeAsString(\""+attr.getName()+"\").indexOf(\""+attr.getValue()+"\")>=0"+ "</java:condition>\n"; } } else if (condition.getSrcComponent().equals("org.cobricks.category")){ if(attr.getType()==0) ru=ru+"<java:condition>category.getAttributeAsString(\""+attr.getName()+"\").equals(\""+ attr.getValue()+"\")</java:condition>\n"; else if(attr.getType()==1) ru=ru+"<java:condition>category.getAttributeAsString(\""+attr.getName()+"\").compareTo(\""+ attr.getValue()+"\")>0</java:condition>\n"; else if(attr.getType()==2) ru=ru+"<java:condition>category.getAttributeAsString(\""+attr.getName()+"\").compareTo(\""+ attr.getValue()+"\")<0</java:condition>\n"; else if(attr.getType()==3) ru=ru+"<java:condition>category.getAttributeAsString(\""+attr.getName()+"\").indexOf(\""+attr.getValue()+"\")>=0"+ "</java:condition>\n"; } else if(condition.getSrcComponent().equals("org.cobricks.context")){ if(attr.getType()==0) ru=ru+"<java:condition>context.getAttributeAsString(\""+attr.getName()+"\").equals(\""+ attr.getValue()+"\")</java:condition>\n"; else if(attr.getType()==1) ru=ru+"<java:condition>context.getAttributeAsString(\""+attr.getName()+"\").compareTo(\""+ attr.getValue()+"\")>0</java:condition>\n"; else if(attr.getType()==2) ru=ru+"<java:condition>context.getAttributeAsString(\""+attr.getName()+"\").compareTo(\""+ attr.getValue()+"\")<0</java:condition>\n"; else if(attr.getType()==3) ru=ru+"<java:condition>context.getAttributeAsString(\""+attr.getName()+"\").indexOf(\""+attr.getValue()+"\")>=0"+ "</java:condition>\n"; } } } } Iterator i_a=a.iterator(); ru=ru+"<java:consequence>\n"; while(i_a.hasNext()){ Action action=(Action)i_a.next(); switch(action.type){ case Action.SENDMSG: ActionSendMsg actMsg = (ActionSendMsg)action; ru=ru+"sendMsg( coreManager, creator,"+actMsg.getToUserID()+", "+actMsg.getPriority()+", \""+actMsg.getSubject()+"\",\""+actMsg.getContent()+"\");\n"; break; case Action.SENDMAIL: ActionSendMail actMail = (ActionSendMail)action; String smtphost=coreManager.getProperty("message.email.smtphost"); if (smtphost == null || smtphost.trim().length()<1) { logger.warn("no SMTP host defined"); } String emailfrom = coreManager.getProperty("message.email.defaultfrom"); ru=ru+"sendEmail( coreManager, \""+smtphost+"\", \""+emailfrom+"\", \""+ actMail.getEmailTo()+"\", \""+actMail.getSubject()+"\",\""+actMail.getContent()+"\");\n"; break; case Action.SETATTR: ActionSetAttr actSet = (ActionSetAttr)action; if(actSet.getObjectName().equals("item")) ru=ru+"setAttr( coreManager, item,"+actSet.getObjectID()+", \""+actSet.getAName()+ "\", \""+actSet.getAValue()+"\");\n"; else if(actSet.getObjectName().equals("category")) ru=ru+"setAttr( coreManager, category,"+actSet.getObjectID()+", \""+actSet.getAName()+ "\", \""+actSet.getAValue()+"\");\n"; else if(actSet.getObjectName().equals("context")) ru=ru+"setAttr( coreManager, context,"+actSet.getObjectID()+", \""+actSet.getAName()+ "\", \""+actSet.getAValue()+"\");\n"; else if(actSet.getObjectName().equals("course")) ru=ru+"setAttr( coreManager, course,"+actSet.getObjectID()+", \""+actSet.getAName()+ "\", \""+actSet.getAValue()+"\");\n"; break; case Action.SETANNO: ActionAnnotation actAnno=(ActionAnnotation)action; if(actAnno.getRating()==null||actAnno.getRating().equals("")||actAnno.getRating().equals(" "))actAnno.setRating("0"); ru=ru+"setAnnotation( coreManager, creator, item, \""+ actAnno.getLanguage()+"\",\""+actAnno.getTitle()+"\", \""+actAnno.getContent()+"\", "+actAnno.getRating()+");\n"; break; case Action.SETRAT: ActionRating actRat=(ActionRating)action; ru=ru+"setRating( coreManager,creator, item, "+actRat.getRating()+");\n"; } } ru=ru+"</java:consequence>\n"; b=ru.getBytes(); bos.write(b); bos.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } --- NEW FILE: Attribute.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class Attribute { public static final int EQUAL = 0; public static final int GREATER = 1; public static final int SMALLER = 2; public static final int LIKE = 3; private String name; private String value; private int type; public Attribute (String name, int type, String value){ if (type < 0 || type > 3) type = 3; this.name = name; this.type = type; this.value = value; } /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the type. */ public int getType() { return type; } /** * @param type The type to set. */ public void setType(int type) { this.type = type; } /** * @return Returns the value. */ public String getValue() { return value; } /** * @param value The value to set. */ public void setValue(String value) { this.value = value; } public String toString(){ StringBuffer result = new StringBuffer(); result.append(name); if (type== EQUAL) result.append("="); else if (type== GREATER) result.append(">"); else if (type == SMALLER) result.append("<"); else result.append("~"); result.append(value); return result.toString(); } } --- NEW FILE: ActionAnnotation.java --- /* * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * This file is part of a free software package; you can redistribute * it and/or modify it under the terms of the Cobricks Software Licence; * either version 1.0 of the License, or (at your option) any later * version (see www.cobricks.de). * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ package org.cobricks.agent; import java.util.ArrayList; import java.util.Iterator; /** * * @author Han Jiang * @author Tong Tong * @author Ye Shen * @version $Date: 2006/02/13 12:37:05 $ */ public class ActionAnnotation extends Action { private String title; private String rating; private String content; private String language; public ActionAnnotation(){ this.type = Action.SETANNO; } /* public ActionSendMail(String et, String subj, String cont){ this(); emailTo = et; subject = subj; content = cont; } */ // Format of mailFromDB: Set Annotation:<title>:<content>:<rating>:<language> // format ???????????????? public ActionAnnotation (int actionID, String AnnoFromDB){ this.actionID = actionID; String[] cont = AnnoFromDB.split(":",5); title = cont[1]; content = cont[2]; rating = cont[3]; language= cont[4]; } /* * @see java.lang.Object#toString() */ public String toString() { StringBuffer result = new StringBuffer("Set Annotation:"); result.append(title+":"); result.append(content+":"); result.append(rating+":"); result.append(language); return result.toString(); } /** * the output html format for Velocity template * * @see org.cobricks.agent.Action#toHtmlString() * @return the output html format for Velocity template (Ye Shen) * */ public String toHtmlString() { // TODO Auto-generated method stub return null; } /** * @return Returns the subject. */ public String getTitle() { return title; } /** * @param subject The subject to set. */ public void setTitle(String t) { title = t; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getRating() { return rating; } public void setRating(String rat) { rating = rat; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } } --- NEW FILE: AgentManagerImpl.java --- /* * Copyright (c) 2005 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 org.cobricks.agent; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import org.apache.log4j.Logger; import org.cobricks.category.Category; import org.cobricks.category.CategoryManager; import org.cobricks.context.Context; import org.cobricks.context.ContextManager; import org.cobricks.core.CobricksException; import org.cobricks.core.ComponentDirectory; import org.cobricks.core.ComponentEvent; import org.cobricks.core.ComponentManagerAdaptor; import org.cobricks.core.CoreManager; import org.cobricks.core.db.DBAccess; import org.cobricks.course.Course; import org.cobricks.course.CourseManager; import org.cobricks.item.Item; import org.cobricks.item.ItemManager; import org.cobricks.user.User; import org.cobricks.user.UserManager; import org.drools.DroolsException; import org.xml.sax.SAXException; /** * Implementation of the MessageManager interface. * * @author mic...@ac... * @version $Date: 2006/02/13 12:37:05 $ */ public class AgentManagerImpl extends ComponentManagerAdaptor implements AgentManager { static Logger logger = Logger.getLogger(AgentManagerImpl.class); static String COMP_NAME = "Cobricks-2 Agent Manager"; static String COMP_VERSION = "V0.2 (Feb. 2004)"; private Map totalRules; static String DRL_dir; // private DRLCreator drlCreator; /** * */ public AgentManagerImpl() { super(); totalRules = new HashMap(); } public String getComponentName() { return COMP_NAME; } public String getComponentVersion() { return COMP_VERSION; } public void obtainRules(){ List ruleUserIDs = dbAccess.sqlQuery("SELECT * FROM user_rules"); if (ruleUserIDs.isEmpty()) return; for (int i = 0;i<ruleUserIDs.size();i++){ Map ruleID_userID = (Map)ruleUserIDs.get(i); int ruleID = Integer.parseInt(ruleID_userID.get("ruleid").toString()); int userID = Integer.parseInt(ruleID_userID.get("userid").toString()); obtainRuleForUser(ruleID, userID); } } private void obtainRuleForUser(int ruleID, int userID){ List rulesForUser = (List)totalRules.get(new Integer(userID)); if (rulesForUser == null){ rulesForUser = new ArrayList(); totalRules.put(new Integer(userID), rulesForUser); } Rule rule = new Rule(); rule.setRuleID(ruleID); List conditions = dbAccess.sqlQuery("SELECT rule_conditionID, rule_condition "+ " FROM user_rulesconditions WHERE ruleID="+ruleID); for (int i = 0;i<conditions.size();i++){ Map conditionMap = (Map)conditions.get(i); int conditionID = Integer.parseInt(conditionMap.get("rule_conditionid").toString()); String conFromDB = conditionMap.get("rule_condition").toString(); Condition condition = new Condition(conditionID, conFromDB); rule.addCondition(condition); } List actions = dbAccess.sqlQuery("SELECT rule_actionID, rule_action, message"+ " FROM user_rulesactions WHERE ruleID="+ruleID); for (int i = 0;i<actions.size();i++){ Map actionMap = (Map)actions.get(i); int actionID = Integer.parseInt(actionMap.get("rule_actionid").toString()); String conFromDB = actionMap.get("rule_action").toString(); String message = actionMap.get("message").toString(); Action action = null; if (conFromDB.startsWith("Send Email")){ action = new ActionSendMail(actionID,conFromDB, message); } else if (conFromDB.startsWith("Send Message")){ action = new ActionSendMsg(actionID, conFromDB, message); } else if (conFromDB.startsWith("Set Annotation")){ action = new ActionAnnotation(actionID, conFromDB); } else if (conFromDB.startsWith("Set Rating")){ action = new ActionRating(actionID, conFromDB); } else { action = new ActionSetAttr(actionID, conFromDB); } rule.setAction(action); } rulesForUser.add(rule); } public List getRulesForUser(int userID){ List rulesForUser = (List)totalRules.get(new Integer(userID)); return rulesForUser; } public void insertRuleForUser(int userID, Rule rule){ try{ // Add a rule in the object totalRules if(totalRules.get(new Integer(userID))!=null){ logger.debug("this user has rules already!"); List rulesForUser = (List)totalRules.get(new Integer(userID)); rulesForUser.add(rule); totalRules.remove(new Integer(userID)); totalRules.put(new Integer(userID),rulesForUser); } else{ logger.debug("this user has no rules!"); List rulesForUser=new ArrayList(); rulesForUser.add(rule); totalRules.put(new Integer(userID),rulesForUser); } // Add the new rule in the database logger.debug("hier add rule database!"); int newRuleID = Integer.parseInt( dbAccess.getNewPrimaryKey("user_rules","ruleID") ); Map user_rule = new HashMap(); rule.setRuleID(newRuleID); user_rule.put("userID", new Integer(userID)); user_rule.put("ruleID", new Integer(newRuleID)); dbAccess.sqlInsert("user_rules",user_rule); // Conditions logger.debug("hier add condition database"); List conditions = rule.getConditions(); for (int i=0; i<conditions.size();i++){ int newConditionID = Integer.parseInt( dbAccess.getNewPrimaryKey("user_rulesconditions","rule_conditionID") ); ((Condition)conditions.get(i)).setConditionID(newConditionID); Map condMap= new HashMap(); condMap.put("ruleID",new Integer(newRuleID)); condMap.put("rule_conditionID",new Integer(newConditionID)); condMap.put("rule_condition",conditions.get(i).toString()); dbAccess.sqlInsert("user_rulesconditions", condMap); } // Actions logger.debug("hier add action database"); List actions = rule.getActions(); for (int i=0; i<actions.size();i++){ int newActionID = Integer.parseInt( dbAccess.getNewPrimaryKey("user_rulesactions","rule_actionID") ); ((Action)actions.get(i)).setActionID(newActionID); Map actMap= new HashMap(); actMap.put("ruleID",new Integer(newRuleID)); actMap.put("rule_actionID",new Integer(newActionID)); actMap.put("rule_action",actions.get(i).toString()); actMap.put("message", ((Action)actions.get(i)).getContent()); dbAccess.sqlInsert("user_rulesactions", actMap); } logger.debug("hier create drl"); logger.debug(Integer.toString(userID)); DRLCreator drlCreator = new DRLCreator(totalRules, DRL_dir, userID, coreManager); } catch(Exception e){ logger.debug(e.toString()); } } public void delRule(int userID, Rule rule){ // remove the rule from the object totalRules List rulesForUser = (List)totalRules.get(new Integer(userID)); int ruleID = rule.getRuleID(); rulesForUser.remove(rule); // remove the rule from the database dbAccess.sqlDelete("user_rules", "ruleID="+ruleID); dbAccess.sqlDelete("user_rulesconditions", "ruleID="+ruleID); dbAccess.sqlDelete("user_rulesactions", "ruleID="+ruleID); DRLCreator drlCreator = new DRLCreator(totalRules, DRL_dir, userID, coreManager); } public void updateRule( int userID, Rule rule){ // update the rule in the database. // TODO update the rule in the totalRules? // Bis jetzt wird hier geleistet: Condition, Action: change // Noch nicht ber¨¹cksichtigt: Condition, Action :add or delete List conditions = rule.getConditions(); for (int i= 0;i<conditions.size();i++){ Condition condition = (Condition)conditions.get(i); Map condMap= new HashMap(); condMap.put("rule_condition",condition.toString()); dbAccess.sqlUpdate("user_rulesconditions", condMap, "rule_conditionID="+condition.getConditionID()); } List actions = rule.getActions(); for (int i= 0;i<actions.size();i++){ Action action = (Action)actions.get(i); Map condMap= new HashMap(); condMap.put("rule_action", action.toString()); condMap.put("",action.getContent()); dbAccess.sqlUpdate("user_rulesactions", condMap, "rule_actionID="+action.getActionID()); } DRLCreator drlCreator = new DRLCreator(totalRules, DRL_dir,userID, coreManager); } /** * */ public void init(String componentId, String managerId, Properties properties, CoreManager coreManager, DBAccess dbAccess) throws Exception { super.init(componentId, managerId, properties, coreManager, dbAccess); DRL_dir=properties.getProperty("agent.DRL_dir"); ComponentDirectory componentDirectory = coreManager.getComponentDirectory(); componentDirectory.registerManager(managerId, this); logger.info("Checking and updating the agent component " +"database tables"); Set set = dbAccess.getComponentTableNames(getComponentId()); Iterator i = set.iterator(); while (i.hasNext()) { String tablename = (String)i.next(); int res = dbAccess.checkTable(tablename); if (res == -1) dbAccess.createTable(tablename); else if (res == -2) { if (!dbAccess.updateTable(tablename)) logger.error("Updating table "+tablename+" failed."); } } obtainRules(); UserManager userManager = (UserManager) coreManager.getComponentDirectory().getManager("userManager"); if(userManager!=null){ List userIdList=userManager.getUserIdList(); for(int j=0; j<userIdList.size();j++){ String userID=userIdList.get(j).toString(); DRLCreator drlCreator = new DRLCreator(totalRules, DRL_dir,Integer.parseInt(userID), coreManager); } } } /** * */ /* ************************************************************ */ /** * Check which users want to receive the component event and deliver * it to the users as message. */ public void processEvent(ComponentEvent event) { logger.info("Receiving event "+event.getAction()+" for " +event.getDomain() +" from "+event.getSourceComponentId()); ComponentEventThread t = new ComponentEventThread(event); t.start(); } /* ************************************************************ */ /* Thread for processing component events */ class ComponentEventThread extends Thread { ComponentEvent event; ComponentEventThread(ComponentEvent event) { this.event = event; } public void run() { String opt=event.getAction(); logger.debug(opt); UserManager userManager = (UserManager) coreManager.getComponentDirectory().getManager("userManager"); User user = userManager.getUser(event.getUserId()); ... [truncated message content] |
|
From: jiang <jia...@us...> - 2006-02-13 12:37:07
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/agent/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2858/src/org/cobricks/agent/db Log Message: Directory /cvsroot/cobricks/cobricks2/src/org/cobricks/agent/db added to the repository |
|
From: jiang <jia...@us...> - 2006-02-13 12:37:07
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/agent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2858/src/org/cobricks/agent Log Message: Directory /cvsroot/cobricks/cobricks2/src/org/cobricks/agent added to the repository |
|
From: lochmann <loc...@us...> - 2006-02-12 19:43:47
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28352/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Social Networks. Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- UserManagerImpl.java 12 Feb 2006 19:08:26 -0000 1.56 +++ UserManagerImpl.java 12 Feb 2006 19:43:39 -0000 1.57 @@ -173,7 +173,7 @@ private LinkedHashMap userGraphCacheOutgoing; /* Maximum size of paths */ - private static final int USER_GRAPH_MAX_PATH_SIZE = 8; + private static final int USER_GRAPH_MAX_PATH_SIZE = 10; /* * Class that overrides LinkedHashMap. |
|
From: lochmann <loc...@us...> - 2006-02-12 19:08:39
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17353/src/org/cobricks/user Modified Files: UserPresenter.java UserManagerImpl.java UserManager.java Log Message: Social Networks. Index: UserPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserPresenter.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- UserPresenter.java 24 Jan 2006 06:50:40 -0000 1.31 +++ UserPresenter.java 12 Feb 2006 19:08:25 -0000 1.32 @@ -799,6 +799,51 @@ logger.error(LogUtil.ex("Failed removing role.", e)); } } + + /** + * This method returns the shortest path from startuserid to enduserid. + * + * @param startuserid + * @param enduserid + * + * @return list of users + */ + + public List getUserPath(int startuserid, int enduserid) { + try { + List l = this.userManager.getUserPath(startuserid, enduserid); + List erg = new ArrayList(l.size()); + Iterator i = l.iterator(); + while(i.hasNext()) { + Integer userid = (Integer) i.next(); + User user = userManager.getUser(userid); + erg.add(user); + } + return erg; + } catch (Exception e) { + logger.error(LogUtil.ex("Failed to get UserPath.", e)); + } + return new ArrayList(); + } + + /** + * This method returns all paths from startuser to enduser + * + * @param userid + * @param attrname + * @param lang + * @return + */ + + public List getUserPaths(int startuserid, int enduserid) { + try { + return this.userManager.getUserPaths(startuserid, enduserid); + } catch (Exception e) { + logger.error(LogUtil.ex("Failed to get UserPaths.", e)); + } + return new ArrayList(); + } + } Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- UserManagerImpl.java 24 Jan 2006 06:50:40 -0000 1.55 +++ UserManagerImpl.java 12 Feb 2006 19:08:26 -0000 1.56 @@ -19,6 +19,8 @@ import java.sql.PreparedStatement; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -31,6 +33,7 @@ import java.util.SortedSet; import java.util.StringTokenizer; import java.util.TreeSet; +import java.util.LinkedHashMap; import org.apache.log4j.Logger; @@ -147,6 +150,47 @@ private AttributeDescriptorManager attributeDescriptorManager; private OntologyClass userOntologyClass = null; + + /* + * Buddylist-Graph + * The buddylist is seen as a directed graph. + * Each user is seen as a vertice. The edges are defined through the + * buddylist entries. + * + * To work with such user-graphs efficiently, two caches are implemented. + * One for the outgoing edges, and one for the incoming edges. The caches + * are implemented as Last Recently User (LRU) Caches, with a maximum + * capacity of USER_GRAPH_CACHE_MAX. + * + * The caches associate a userid (data type: Integer) to a list of userids + * (data type: List containing Integer). + * + * For accessing the caches the methods getUserGraphIncoming(), + * getUserGraphOutgoing() and clearUserGraphCache() are used. + */ + private static final int USER_GRAPH_CACHE_MAX = 512; + private LinkedHashMap userGraphCacheIncoming; + private LinkedHashMap userGraphCacheOutgoing; + + /* Maximum size of paths */ + private static final int USER_GRAPH_MAX_PATH_SIZE = 8; + + /* + * Class that overrides LinkedHashMap. + */ + private class LRUCache extends LinkedHashMap { + + public LRUCache(int initialCapacity) { + // The 3th parameter indicates, that this LinkedMap is access-ordered. + super(initialCapacity, 0.75f, true); + } + + // If there are already USER_GRAPH_CACHE_MAX entries, so the oldest + // entry has to be removed. + protected boolean removeEldestEntry(Map.Entry eldest) { + return size() > USER_GRAPH_CACHE_MAX; + } + }; /** * Creates a new UserManagerImpl object. @@ -154,6 +198,10 @@ public UserManagerImpl() { super(); + + // Initialize the two caches with the maximum size as initial capacity + userGraphCacheIncoming = new LRUCache(USER_GRAPH_CACHE_MAX); + userGraphCacheOutgoing = new LRUCache(USER_GRAPH_CACHE_MAX); } /** @@ -1987,6 +2035,364 @@ LAIdffBridge bridge = LAIdffBridge.getSingleInstance(); return bridge; } - + + /** + * Gets the outgoing edges of the user userid directly from the database. + * @param userid + * @return List of userids (Integer) + */ + private List getUserGraphOutgoingFromDatabase(Integer userid) { + List result = this.dbAccess.sqlQuery("SELECT DISTINCT " + SINKUSERID + + " FROM " + TABLE_USER_ATTRUSER + " WHERE " + User.USERID + + "=" + userid + " AND " + ANAME + "=\"" + User.BUDDYLIST + + "\""); + List l = new ArrayList(result.size()); + Iterator i = result.iterator(); + while (i.hasNext()) { + Map row = (Map) i.next(); + l.add((Integer) row.get(SINKUSERID)); + } + return l; + } + + /** + * Gets the incoming edges of the user userid directly from the database. + * @param userid + * @return List of userids (Integer) + */ + private List getUserGraphIncomingFromDatabase(Integer userid) { + + List result = this.dbAccess.sqlQuery("SELECT DISTINCT " + User.USERID + + " FROM " + TABLE_USER_ATTRUSER + " WHERE " + SINKUSERID + + "=" + userid + " AND " + ANAME + "=\"" + User.BUDDYLIST + + "\""); + List l = new ArrayList(result.size()); + Iterator i = result.iterator(); + while (i.hasNext()) { + Map row = (Map) i.next(); + l.add((Integer) row.get(User.USERID)); + } + return l; + } + + + /** + * Returs the list of incoming edges to the user userid. Uses the + * UserGraphCache. + * + * @param userid + * @return List of userids (Integer) + * + */ + public List getUserGraphIncoming(Integer userid) { + List edges = (List) this.userGraphCacheIncoming.get(userid); + if(edges != null) { + return edges; + } + edges = getUserGraphIncomingFromDatabase(userid); + this.userGraphCacheIncoming.put(userid, edges); + return edges; + } + + /** + * Returns the list of outgoing edges of the user userid. Uses the + * UserGraphCache. + * + * @param userid + * @return List of userids (Integer) + * + */ + public List getUserGraphOutgoing(Integer userid) { + List edges = (List) this.userGraphCacheOutgoing.get(userid); + if(edges != null) { + return edges; + } + edges = getUserGraphOutgoingFromDatabase(userid); + this.userGraphCacheOutgoing.put(userid, edges); + return edges; + } + + /** + * Clears both the userGraphCacheIncoming and the userGraphCacheOutgoing. + */ + public void clearUserGraphCache() { + userGraphCacheIncoming.clear(); + userGraphCacheOutgoing.clear(); + } + + /** + * Method that gets the shortest possible path from startuserid to enduserid. + * A bidirectional breadth-first search is executed: 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 + * + * @author lochmann + * + * @param startuserid + * @param enduserid + * + * @return Path from startuserid to enduserid + * + */ + public List getUserPath(int startuserid, int enduserid) + throws CobricksException { + + final int MAX_PATH = USER_GRAPH_MAX_PATH_SIZE / 2; + + /* Create two paths, with one entry */ + List startPath = new ArrayList(); + List endPath = new ArrayList(); + startPath.add(new Integer(startuserid)); + endPath.add(new Integer(enduserid)); + + /* Lists to collect all paths */ + List pathsStartToEnd = new ArrayList(); + List pathsEndToStart = new ArrayList(); + + /* Lists to collect the paths calculated during the previous step */ + List pathsStartToEndPrev = new ArrayList(); + List pathsEndToStartPrev = new ArrayList(); + + /* Add the one-element-paths, to this lists */ + pathsStartToEnd.add(startPath); + pathsEndToStart.add(endPath); + pathsStartToEndPrev.add(startPath); + pathsEndToStartPrev.add(endPath); + + List foundPaths = new ArrayList(); + for(int pathlength = 2; pathlength <= MAX_PATH; pathlength ++) { + /* Extend the paths by one element */ + pathsStartToEndPrev = expandStartToEndPaths(pathsStartToEndPrev); + pathsEndToStartPrev = expandEndToStartPaths(pathsEndToStartPrev); + + /* Add the new paths to the path-collection */ + pathsStartToEnd.addAll(pathsStartToEndPrev); + pathsEndToStart.addAll(pathsEndToStartPrev); + + /* Interception set */ + foundPaths = interceptPaths(pathsStartToEnd, pathsEndToStart); + + /* If at least one path was found, break */ + if(!foundPaths.isEmpty()) { + break; + } + } + + logger.debug("caches: "+this.userGraphCacheIncoming.size() + " "+this.userGraphCacheOutgoing.size()); + + /* Sort the paths */ + Collections.sort(foundPaths, + new java.util.Comparator() { + public int compare(Object o1, Object o2) { + List l1 = (List) o1; + List l2 = (List) o2; + return l1.size() - l2.size(); + } + } + ); + + /* Return the shortest path */ + return (List) foundPaths.get(0); + } + + /** + * Method that gets all possible paths from startuserid to enduserid. + * A bidirectional breadth-first search is executed: 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 + * + * @author lochmann + * + * @param startuserid + * @param enduserid + * + * @return List of lists of UserIds + * + */ + public List getUserPaths(int startuserid, int enduserid) + throws CobricksException { + + final int MAX_PATH = USER_GRAPH_MAX_PATH_SIZE / 2; + + /* Create two paths, with one entry */ + List startPath = new ArrayList(); + List endPath = new ArrayList(); + startPath.add(new Integer(startuserid)); + endPath.add(new Integer(enduserid)); + + /* Lists to collect all paths */ + List pathsStartToEnd = new ArrayList(); + List pathsEndToStart = new ArrayList(); + + /* Lists to collect the paths calculated during the previous step */ + List pathsStartToEndPrev = new ArrayList(); + List pathsEndToStartPrev = new ArrayList(); + + /* Add the one-element-paths, to this lists */ + pathsStartToEnd.add(startPath); + pathsEndToStart.add(endPath); + pathsStartToEndPrev.add(startPath); + pathsEndToStartPrev.add(endPath); + + + for(int pathlength = 2; pathlength <= MAX_PATH; pathlength ++) { + /* Extend the paths by one element */ + pathsStartToEndPrev = expandStartToEndPaths(pathsStartToEndPrev); + pathsEndToStartPrev = expandEndToStartPaths(pathsEndToStartPrev); + + /* Add the new paths to the path-collection */ + pathsStartToEnd.addAll(pathsStartToEndPrev); + pathsEndToStart.addAll(pathsEndToStartPrev); + } + + logger.debug("caches: "+this.userGraphCacheIncoming.size() + " "+this.userGraphCacheOutgoing.size()); + + /* Interception */ + List foundPaths = interceptPaths(pathsStartToEnd, pathsEndToStart); + + /* Sort the paths */ + Collections.sort(foundPaths, + new java.util.Comparator() { + public int compare(Object o1, Object o2) { + List l1 = (List) o1; + List l2 = (List) o2; + return l1.size() - l2.size(); + } + } + ); + + /* Return all paths */ + return foundPaths; + } + + /** + * Searchs for all paths of length (pathlength-1), extends them by one + * element by using the set returned by getUserGraphOutgoing(). + * + * @param pathsStartToEnd List of paths + * @param pathlength length of paths that should be expanded + */ + private List expandStartToEndPaths(List pathsStartToEnd) { + /* New Paths */ + List newPaths = new ArrayList(); + + /* Every path in the list will be processed */ + Iterator i = pathsStartToEnd.iterator(); + while(i.hasNext()) { + List path = (List) i.next(); + Integer lastVertex = (Integer) path.get(path.size() - 1); + + /* Calculate the following vertices */ + List newVertices = this.getUserGraphOutgoing(lastVertex); + Iterator j = newVertices.iterator(); + while(j.hasNext()) { + Integer newVertex = (Integer) j.next(); + + /* Add the vertex to the path */ + List newPath = new ArrayList(path.size() + 1); + for(int x = 0; x < path.size(); x ++) + newPath.add(path.get(x)); + newPath.add(newVertex); + + /* Add the newly generated path to the list */ + newPaths.add(newPath); + } + } + return newPaths; + } + + /** + * Extends all paths by one element by using the set returned + * by getUserGraphIncoming(). + * + * @param pathsEndToStart List of paths + */ + private List expandEndToStartPaths(List pathsEndToStart) { + /* New paths */ + List newPaths = new ArrayList(); + + /* Every path in the list will be processed */ + Iterator i = pathsEndToStart.iterator(); + while(i.hasNext()) { + List path = (List) i.next(); + Integer lastVertex = (Integer) path.get(0); + + /* Calculate the following vertices */ + List newVertices = this.getUserGraphIncoming(lastVertex); + Iterator j = newVertices.iterator(); + while(j.hasNext()) { + Integer newVertex = (Integer) j.next(); + + /* Add the new vertex at the beginning of the old path */ + List newPath = new ArrayList(path.size() + 1); + newPath.add(newVertex); + newPath.addAll(path); + + /* Add the newly generated path to the list */ + newPaths.add(newPath); + } + } + return newPaths; + } + + /** + * Calculates the interception between the paths from the start- to + * the end-vertex and the end- to the start-vertex. The result are the + * paths from the startuserid to the enduserid. + * + * @param pathsStartToEnd + * @param pathsEndToStart + * @return List of paths + */ + private List interceptPaths(List pathsStartToEnd, List pathsEndToStart) { + /* Set, that contains all found paths */ + Set alreadyFoundPaths = new HashSet(); + + /* List, that contains all found paths */ + List foundPaths = new ArrayList(); + + Iterator startToEndIter = pathsStartToEnd.iterator(); + while(startToEndIter.hasNext()) { + List startToEndPath = (List) startToEndIter.next(); + Iterator endToStartIter = pathsEndToStart.iterator(); + while(endToStartIter.hasNext()) { + List endToStartPath = (List) endToStartIter.next(); + + /* If the last element of the first path, equals to the + * first element of the second path, than we found a complete + * path + */ + if(startToEndPath.get(startToEndPath.size() - 1).equals( + endToStartPath.get(0))) { + + /* Combine the paths */ + List foundPath = new ArrayList(startToEndPath.size() + endToStartPath.size() -1); + foundPath.addAll(startToEndPath); + for(int i = 1; i < endToStartPath.size(); i ++) { + foundPath.add(endToStartPath.get(i)); + } + + /* Check if a path contains the same vertex multiple times */ + HashSet duplicates= new HashSet(); + boolean containsDuplicate = false; + Iterator i = foundPath.iterator(); + while(i.hasNext()) { + Integer element = (Integer) i.next(); + if(duplicates.contains(element)) { + containsDuplicate = true; + } + duplicates.add(element); + } + + /* Only new paths, with no duplicate vertices must be added */ + if(!alreadyFoundPaths.contains(foundPath) && !containsDuplicate) { + foundPaths.add(foundPath); + alreadyFoundPaths.add(foundPath); + } + } + } + } + return foundPaths; + } } Index: UserManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManager.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- UserManager.java 21 Oct 2005 15:56:46 -0000 1.19 +++ UserManager.java 12 Feb 2006 19:08:27 -0000 1.20 @@ -326,4 +326,32 @@ public boolean checkCredentials(User user, Object credential); public UserHandler getUserHandler(String userlogin); + + /** + * Method that gets all possible paths from startuserid to enduserid + * + * @author lochmann + * + * @param startuserid + * @param enduserid + * + * @return List of lists of UserIds + * + */ + public List getUserPaths(int startuserid, int enduserid) + throws CobricksException; + + /** + * Method that gets the (one of the) shortest paths from startuserid to + * enduserid + * + * @author lochmann + * + * @param startuserid + * @param enduserid + * + * @return List of UserIds + */ + public List getUserPath(int startuserid, int enduserid) + throws CobricksException; } |
|
From: lochmann <loc...@us...> - 2006-02-12 19:08:03
|
Update of /cvsroot/cobricks/cobricks2/web/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17035/web/user Modified Files: user-buddylist.html.en card.html.en Added Files: user-buddylist-search.html.en user-allpaths.html.en Log Message: Social Networks. --- NEW FILE: user-allpaths.html.en --- #parse ( "pageheader.html" ) #set ( $userida = $userManager.getUserIdForUserLogin($!usera) ) #set ( $useridb = $userManager.getUserIdForUserLogin($!userb) ) #set ( $usera = $userManager.getUser($userida) ) #set ( $userb = $userManager.getUser($useridb) ) #set ( $usernamea = $usera.getUserLogin() ) #set ( $usernameb = $userb.getUserLogin() ) <h1>Social Networks</h1> <p> Paths from user <em> $usernamea </em> to user <em> $usernameb </em> </p> #set ( $paths = $userPresenter.getUserPaths($userida, $useridb) ) #set ( $pathssize = $paths.size() ) #set ( $pathsmaxindex = $pathssize - 1 ) <p> Number of found paths: $pathssize<br> Showing only the first 10 results. </p> #set ( $first = 1 ) #set ( $indexpath = 0 ) <table border=0 style="table-layout:fixed;"> #foreach ($j in $paths) #set ( $indexpath = $indexpath + 1 ) #if ( $indexpath < 10 ) <tr> <td>$indexpath</td> #set ( $maxindex = $j.size() - 1 ) #set ( $index = 0 ) #foreach ($i in $j) #set ( $useri = $userManager.getUser($i) ) <td height=32 valign=bottom align=center style="border:1px solid #DFDFDF;"> #set ($imageuri = "") #set ($imageuri = $useri.getAttribute("basic.personal.imageuri")) #if ($imageuri == "") #set ($imageuri = "/images/nouser.png") #end <img src="$imageuri" width=32 height=32> #set ($userLogin = $useri.getUserLogin()) <br> $userLogin </td> #if($index != $maxindex) <td valign=middle align=center> <img src="/images/arrow.png"> </td> #end #set ($index = $index + 1) #end </tr> #end #end </table> #parse ( "pagefooter.html" ) --- NEW FILE: user-buddylist-search.html.en --- #parse ( "pageheader.html" ) <h1>Search user</h1> <form action="user-buddylist-search.html" method=get> <input type=hidden name=auserlogin value=$!auserlogin> <input type=hidden name=print value=$!print> <table border=0> <tr> <td>User login</td> <td> <input type=text name=searchUserLogin> </td> </tr> <tr> <td>First name</td> <td> <input type=text name=searchFirstName> </td> </tr> <tr> <td>Last name</td> <td> <input type=text name=searchLastName> </td> </tr> <tr> <td>Sort by</td> <td> <select width="40" name="sort"> <option value="1">Login name</option> <option value="2">Lastname</option> <option value="3">Firstname</option> </select> </td> </select> <tr> <td> <input type=submit name=cmd value=Search> </td> </tr> </table> </form> <br><br> <script type="text/javascript"> //<!-- function OkSubmit() { selected = ""; for(i=0; i < document.getElementById("frm").elements.length; i++) { if(document.getElementById("frm").elements[i].name == "newUserLogin") { if(document.getElementById("frm").elements[i].checked == true) { selected = document.getElementById("frm").elements[i].value; } } } opener.document.getElementById("frm1").newUserLogin.value = selected; window.close(); } function openerGoTo(s) { opener.location.href = s; window.close(); } document.write("<form name=frm id=frm onSubmit=\"OkSubmit();return false;\">"); // --> </script> <noscript> <form action="user-buddylist.html" method=get> </noscript> <input type=hidden name=auserlogin value=$!auserlogin> <table border=0 width="100%"> <tr bgcolor="#dfdfdf"> <td> </td> <td> <b>Image</b> </td> <td> <b>Login</b> </td> <td> <b>Name</b> </td> <td> <b>e-mail</b> </td> </tr> #set ( $cmd = $!cmd ) #if ($cmd == "Search") #set ( $loginCond = "1" ) #set ( $fnameCond = "1" ) #set ( $lnameCond = "1" ) #set ( $login = $!searchUserLogin ) #set ( $fname = $!searchFirstName ) #set ( $lname = $!searchLastName ) #set ( $listNames = ["auserlogin", "basic.personal.firstname", "basic.personal.lastname"] ) #set ( $listConditions = [$loginCond, $fnameCond, $lnameCond] ) #set ( $listValues = [$login, $fname, $lname] ) #set ( $orFlag = false ) #set ( $sortBy = "$!sort" ) #set ($result = $userPresenter.searchUsers($!listNames, $!listConditions, $!listValues, $!orFlag, $!sortBy, -1, "user")) #if (($result)) #set( $number = 0 ) #foreach ($i in $result) #set ($uId = $i.getUserId()) #set( $number = $number + 1 ) <tr bgcolor = "#dfdfdf"> <td> <input type=radio name=newUserLogin value="$i.getUserLogin()"> </td> <td> #set ($imageuri = "") #set ($imageuri = $i.getAttribute("basic.personal.imageuri")) #if ("$!imageuri"!="") <img src="$imageuri" width="32" height=32> #end </td> <td> <script type="text/javascript"> // <!-- document.write("<a href=\"javascript:openerGoTo('/user/card.html?auserlogin=$i.getUserLogin()');\"> $i.getUserLogin()</a>"); // --> </script> <noscript> <a href="card.html?auserlogin=$i.getUserLogin()"> $i.getUserLogin()</a> </noscript> </td> <td> $i.getName() </td> <td> $!i.getAttribute("basic.contact.online.email") </td> </tr> #end #else <tr bgcolor="#dfdfdf"> <td colspan=4> <div class="info">The search for users has no results</div> </td> </tr> #end #else <tr bgcolor="#dfdfdf"> <td colspan=4> No search was performed </td> </tr> #end </table> <input type=submit value=OK> </form> #parse ( "pagefooter.html" ) Index: user-buddylist.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/user/user-buddylist.html.en,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- user-buddylist.html.en 5 Jul 2005 05:35:35 -0000 1.2 +++ user-buddylist.html.en 12 Feb 2006 19:07:48 -0000 1.3 @@ -83,12 +83,32 @@ <br><br> <table width="100%"> - <tr bgcolor="dfdfdf"><td width="7%"><b>Delete</b></td><td width="43%"><b>Name</b></td><td width="50%"><b>E-Mail</b></td></tr> + <tr bgcolor="dfdfdf"> + <td width="7%"> + <b>Delete</b> + </td> + <td width="12%"> + <b>Image</b> + </td> + <td width="43%"> + <b>Name</b> + </td> + <td width="38%"> + <b>E-Mail</b> + </td> + </tr> #set ($result = $userPresenter.getUserAttrSet($auserid, "pim.network.buddylist")) #if ($result.size() > 0) #foreach ($i in $result) <tr bgcolor="dfdfdf"> <td align="center"><input type="checkbox" name="id" value="$i.getId()"></td> + <td valign=center> + #set ($imageuri = "") + #set ($imageuri = $i.getAttribute("basic.personal.imageuri")) + #if ("$!imageuri"!="") + <img src="$imageuri" width="32" height=32> + #end + </td> <td><a href="/user/card.html?auserlogin=$i.getUserLogin()">$i.getName()</a></td> <td> #if ($i.getAttribute("basic.contact-work.online.email")) @@ -108,7 +128,7 @@ <p> -<form action="/USER" method="post"> +<form action="/USER" method="post" name=frm1 id=frm1> <input type="hidden" name="cmd" value="addListMember" /> <input type="hidden" name="cmd.success" value="/user/user-buddylist.html" /> <input type="hidden" name="cmd.error" value="/user/user-buddylist.html" /> @@ -123,6 +143,16 @@ <input type="submit" value="Add to the list"> <input name="newUserLogin" size="20" value="$!newUserLogin"> +<script type="text/javascript"> +// <!-- + document.write("<input type=button value=Search onClick=\"window.open('/user/user-buddylist-search.html?print=true&auserlogin=$auserlogin','usersearch','width=500,height=500,scrollbar=yes,menu=no');\">"); +// --> +</script> + +<noscript> + <a href="/user/user-buddylist-search.html?auserlogin=$auserlogin">Search</a> +</noscript> + </td></tr></table> </td></tr></table> Index: card.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/user/card.html.en,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- card.html.en 18 Mar 2005 14:18:20 -0000 1.11 +++ card.html.en 12 Feb 2006 19:07:48 -0000 1.12 @@ -36,6 +36,59 @@ <hr> +#set ( $loggedinid = $userManager.getUserIdForUserLogin($userLogin) ) + +<h3>Path to this user</h3> + +(<a href="/user/user-allpaths?usera=$userLogin&userb=$auserlogin">show all paths</a>) +<br> + +#set ($result = $userPresenter.getUserPath($loggedinid, $auserid)) +#set ($resultsize = $result.size()) +#set ($maxindex = $resultsize - 1) + +#if ($resultsize == 0) + No path to this user found. +#else + <table border=0 style="table-layout:fixed;"> + <tr> + #set ($index = 0) + #foreach ($i in $result) + <td height=32 valign=bottom align=center style="border:1px solid #DFDFDF;"> + #set ($imageuri = "") + #set ($imageuri = $i.getAttribute("basic.personal.imageuri")) + #if ($imageuri == "") + #set ($imageuri = "/images/nouser.png") + #end + + <img src="$imageuri" width=32 height=32> + + #set ($userLogin = $i.getUserLogin()) + + <br> $userLogin + </td> + #if($index != $maxindex) + <td valign=middle rowspan=2 align=center> + <img src="/images/arrow.png"> + </td> + #end + #set ($index = $index + 1) + #end + <!-- + </tr><tr> + #foreach ($i in $result) + #set ($userLogin = $i.getUserLogin()) + <td align=center> + $userLogin + </td> + #end + --> + </tr> + </table> +#end + +<hr> + <h3>All public attributes</h3> #set ($attrNames = []) |