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-01-16 20:43:32
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1396 Modified Files: ItemManagerImpl.java ItemPresenter.java ItemServlet.java Log Message: Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- ItemManagerImpl.java 16 Jan 2006 09:23:44 -0000 1.62 +++ ItemManagerImpl.java 16 Jan 2006 20:43:24 -0000 1.63 @@ -756,6 +756,7 @@ // for all itemclasses y, that are derived from x int pos = query.indexOf("/item[itemclass~"); while (pos >= 0) { + logger.info("trying: "+query); String tmps = query.substring(pos+17); int pos2 = tmps.indexOf("]"); if (pos2 > 0) { Index: ItemPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemPresenter.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- ItemPresenter.java 20 Dec 2005 10:25:30 -0000 1.43 +++ ItemPresenter.java 16 Jan 2006 20:43:24 -0000 1.44 @@ -1453,14 +1453,12 @@ */ public String printRssChannelAttrs(String rssUrl) { - RssChannel channel = new RssChannel(); - + RssChannel channel = new RssChannel(); try { - channel = channel.getRssChannel(rssUrl); + channel = channel.getRssChannel(rssUrl); } catch (Exception e) { - System.out.println("Exception occured: " + e); - + logger.error(LogUtil.ex("Exception occured", e)); } ArrayList allItems = new ArrayList(); @@ -1472,20 +1470,20 @@ int x = 0; do { - rssItem = (RssItem) allItems.get(x); - itemOutput = (itemOutput + - "<b>Item Nr.: </b>"+" " + (x+1) + "</br>\n" + - "<b>Titel: </b>" + rssItem.getTitle() + "</br>\n" + - "<b>Content: </b>" + rssItem.getDescription() + "</br>\n" + - "<b>Link: </b>" + rssItem.getLink() + "</br>\n"); - - x++; + rssItem = (RssItem) allItems.get(x); + itemOutput = (itemOutput + + "<b>Item Nr.: </b>"+" " + (x+1) + "</br>\n" + + "<b>Titel: </b>" + rssItem.getTitle() + "</br>\n" + + "<b>Content: </b>" + rssItem.getDescription() + "</br>\n" + + "<b>Link: </b>" + rssItem.getLink() + "</br>\n"); + + x++; } while (x < count); String a = ("<b>Titel: </b>" + channel.getTitle() + "</br>\n <b>Link: </b>" + channel.getLink() + - "</br>\n <b>Content: </b>" + channel.getDescription() + "</br>\n" + + "</br>\n <b>Content: </b>" + channel.getDescription() + "</br>\n" + "<b>Anzahl Items: </b>" + count + "</br>\n <br>" + itemOutput); - + return a; } Index: ItemServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemServlet.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ItemServlet.java 13 Dec 2005 09:05:03 -0000 1.38 +++ ItemServlet.java 16 Jan 2006 20:43:24 -0000 1.39 @@ -150,11 +150,13 @@ // check access rights PortalUser portalUser = prequest.getPortalUser(); + /* if (!userManager.getAccessControl().checkPermission(portalUser .getUserId(), "item", "create", null)) { prequest.setReturnCode(2000); return "noaccess"; } + */ // check if there is an uploaded attachment that has to be saved // and store it until later @@ -307,12 +309,14 @@ PortalUser portalUser = prequest.getPortalUser(); Map attrs = new HashMap(); attrs.put("itemid", itemid); + /* if (!userManager.getAccessControl(). checkPermission(portalUser.getUserId(), "item", "update", attrs)) { prequest.setReturnCode(2000); return "noaccess"; } + */ Item item = null; try { |
|
From: Michael K. <ko...@us...> - 2006-01-16 20:40:25
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1188 Modified Files: itemontology.xml Log Message: Index: itemontology.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/itemontology.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- itemontology.xml 16 Jan 2006 09:23:58 -0000 1.16 +++ itemontology.xml 16 Jan 2006 20:40:16 -0000 1.17 @@ -18,7 +18,7 @@ </attr> </class> -<class name="wikipage" parent="portalpage"> +<class name="wikipage" parent="portalpagehtml"> <description lang="de">Wikiseite</description> <attr name="content" type="text" multilanguage="true" versioned="true" /> <attr name="creatoruserid" type="int" /> |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:34:32
|
Update of /cvsroot/cobricks/cobricks2/web/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13751/web/portal Modified Files: create.html.en Log Message: Wiki functionality added Index: create.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/portal/create.html.en,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- create.html.en 7 Dec 2005 14:02:08 -0000 1.14 +++ create.html.en 16 Jan 2006 09:34:24 -0000 1.15 @@ -53,6 +53,9 @@ You may also upload a file for the content:<br> <input type="file" name="_file"> <p> +<input type="checkbox" name="createwikipage" value="true"> Create as Wiki Page (otherwise will be created a HTML page) +</p> +<p> <input type="submit" value="Create Page"> </form> |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:27:06
|
Update of /cvsroot/cobricks/cobricks2/web/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12614/web/portal Modified Files: index.html.en edit.html.en list.html.en Added Files: wikibild.jpg createwiki.html.en wikihelp.html listwiki.html.en historywiki.html.en Log Message: Wiki functionality added Index: list.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/portal/list.html.en,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- list.html.en 22 Aug 2005 13:54:30 -0000 1.6 +++ list.html.en 16 Jan 2006 09:26:54 -0000 1.7 @@ -17,6 +17,8 @@ <ul> #foreach( $i in $itemManager.searchItems("/item[itemclass='portalpagehtml']") ) +$i +<br> <li><a href="$i.getPagePath()$i.getPageName()">$i.getAttribute("name")</a>, id=$i.getId() - <a href="edit.html?itemid=$i.getId()">edit</a> - <a href="delete.html?itemid=$i.getId()">delete</a></li> --- NEW FILE: wikibild.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wikihelp.html --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <h1>Wiki Help</h1> <p>This document describe the Wiki elements which can be used in a Wiki-page</p> <h2>Text formatting</h2> <table border="1"> <tr> <th>Commands to enter</th> <th>What will be displayed</th> </tr> <tr> <td>''italic''</td> <td><i>italic</i></td> </tr> <tr> <td>''bold''</td> <td><b>bold</b></td> </tr> <tr> <td>'''''bolditalic'''''</td> <td><b><i>bolditalic</i></b></td> </tr> <tr> <td>== caption ==</td> <td><h2>caption<h2></td> </tr> <tr> <td>=== caption 2 ===</td> <td><h3>caption 2</h3></td> </tr> <tr> <td> * one<br /> * two<br /> ** two-one<br /> ** two-two<br /> * three<br /> </td> <td> <ul> <li>one</li> <li>two</li> <ul> <li>two-one</li> <li>two-two</li> </ul> <li>three</li> </ul> </td> </tr> <tr> <td> # one<br /> # two<br /> ## two-one<br /> ## two-two<br /> # three<br /> </td> <td> <ol> <li>one</li> <li>two</li> <ol> <li>two-one</li> <li>two-two</li> </ol> <li>three</li> </ol> </td> </tr> <tr> <td> Normal text<br /> : intended<br /> :: double intended </td> <td> Normal text <dl> <dd>indented</dd> <dl> <dd>double intended</dd> </dl> </dl> </td> </tr> <tr> <td><!-- unvisible comment --></td> <td> </td> </tr> <tr> <td><nowiki>No ''Wiki-[[Syntax]]''</nowiki></td> <td>No ''Wiki-[[Syntax]]''</td> </tr> </table> <h2>Links</h2> <table border="1"> <tr> <th>Commands to enter</th> <th>What will be displayed</th> </tr> <tr> <td>A simple link to the [[wikihelp]].</td> <td>A simple link to the <a href="$portalRequest.getBaseUrl()wikihelp.html">wikihelp</a></td> </tr> <tr> <td>The same link with another name [[wikihelp|Help for WIKIs]].</td> <td>The same link with another name <a href="$portalRequest.getBaseUrl()wikihelp.html"> Help for WIKIs</a></td> </tr> <tr> <td> Weblinks:<br /> * [[http://www.google.de/]] - description<br /> * [[http://www.google.de/|Google]] </td> <td> Weblinks:<br /> <a href="http://www.google.de/">http://www.google.de/</a> - description<br /> <a href="http://www.google.de/">Google</a> </td> </tr> </table> <h2>Images</h2> <table border="1"> <tr> <th>Commands to enter</th> <th>What will be displayed</th> </tr> <tr> <td>[[:img:wikibild.jpg|Wikibild]]</td> <td><img src="$portalRequest.getBaseUrl()/wikibild.jpg" alt="Wikibild"></td> </tr> </table> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) --- NEW FILE: listwiki.html.en --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Portal Component</a> - <a href="listwiki.html">List Wiki Objects</a></em> <h1>List Wiki Portal Objects</h1> #if ( $returnCode == 1010 ) <p><div class="success">Successfully deleted portal object.</div></p> #end <!-- tbd: "op=useronly", then only show pages editable by current user --> List of Wiki pages stored in the item database: <ul> #foreach( $i in $itemManager.searchItems("/item[itemclass='wikipage']") ) <li><a href="$i.getPagePath()$i.getPageName()">$i.getAttribute("name")</a>, id=$i.getId() - <a href="edit.html?itemid=$i.getId()">edit</a> - <a href="delete.html?itemid=$i.getId()">delete</a></li> #end </ul> <p> <a href="createwiki.html">Create new Wiki Portal Object</a> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) Index: index.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/portal/index.html.en,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- index.html.en 22 Aug 2005 13:54:30 -0000 1.6 +++ index.html.en 16 Jan 2006 09:26:54 -0000 1.7 @@ -21,6 +21,7 @@ <ul> <li><a href="create.html">Create new HTML page</a> +<li><a href="createwiki.html">Create new Wiki page</a> <li><a href="createbin.html">Create new binary object</a> <li><a href="createfolder.html">Create new HTML folder/directory</a> </ul> @@ -30,11 +31,16 @@ <ul> <li><a href="list.html">List HTML pages</a> +<li><a href="listwiki.html">List Wiki pages</a> <li><a href="list.html?op=useronly">List Portal Objects (editable by user)</a> <li><a href="browse.html">List and browse Portal Folders</a> <p> </ul> +<h3>Wiki Help</h3> +<ul> +<li><a href="wikihelp.html" target="_blank">Help for Wiki</a> +</ul> <h3>Access Control</h3> --- NEW FILE: createwiki.html.en --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Portal Component</a> - <a href="createwiki.html">Create Wiki Page</a></em> <h1>Create Wiki Page</h1> #if ( $returnCode == 1101 ) <div class="success">Successfully created portal page.</div><p> #elseif ( $returnCode > 1999 ) <div class="error">Failed creating portal page.</div><p> #if ($errors) <div class="error">The following error(s) ocurred: <ul>#foreach($error in $errors) <li>$corePresenter.printErrorMessage($error, "$!lang")</li> #end</ul></div><br/> #end #end <form action="$contextPath/PORTAL" method="post"> <input type="hidden" name="cmd" value="create"> <input type="hidden" name="cmd.noaccess" value="$contextPath/noaccess.html"> <input type="hidden" name="cmd.success" value="$contextPath/portal/index.html"> <input type="hidden" name="cmd.error" value="$contextPath/portal/create.html"> <input type="hidden" name="path" value="$portalRequest.getPagePath()"/> <input type="hidden" name="fullcontext" value="true" /> <input type="hidden" name="createwikipage" value="true" /> Path: <select name="ppath"> #foreach ($p in $portalManager.getPortalFolderPaths()) <option value="$p">$p #end </select> <a href="createfolder.html">Create New Folder</a> <p> Page Name (with ".html" or similar extensions):<br> <input name="pname" size="50"> <p> Language: <select name="plang"> $portalPresenter.printLanguageOptions("") </select> <p> Title:<br> <input name="title" size="60"> <p> <textarea name="content" rows="15" cols="75"> $portalPresenter.parse("\$contextPath/pageheaderwiki.html", \$portalRequest) CONTENT $portalPresenter.parse("\$contextPath/pagefooterwiki.html", \$portalRequest) </textarea><br> You may also upload a file for the content:<br> <input type="file" name="_file"> <p> <input type="submit" value="Create Wiki Page"> </form> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) Index: edit.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/portal/edit.html.en,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- edit.html.en 22 Aug 2005 13:54:30 -0000 1.9 +++ edit.html.en 16 Jan 2006 09:26:54 -0000 1.10 @@ -43,11 +43,13 @@ <tr><td> Name: <input type="text" name="name" value="$!name" size="45"/> <p> </p> + </td></tr> #if ("$!_submit" == "Add Language") #set ( $lg = ${_addlang} ) #set ( $title = $page.getTitle("$lg") ) #set ( $content = $page.getPageContent("$lg") ) + <input type="hidden" name="plang" value="$lg"> <tr><td> <table border="1" bgcolor="#eeeeee"><tr><td> @@ -63,7 +65,9 @@ #set ( $langs = $page.getUsedLanguages() ) #foreach( $lg in $langs ) #set ( $title = $page.getAttribute("title_$lg") ) -#set ( $content = $page.getAttribute("content_$lg") ) +<!-- #set ( $content = $page.getAttribute("content_$lg") ) --> +#set ( $content = $itemManager.getContentVersion($itemid, $lg, $versionid) ) + <input type="hidden" name="plang" value="$lg"> <tr><td> <table border="1" bgcolor="#eeeeee"><tr><td> @@ -78,6 +82,22 @@ #end </table> +<p> +#if ("wikipage" == $page.getAttribute("ontologyclassname")) +<p> +<a href="wikihelp.html" target="_blank">Help for Wiki</a> +</p> +#if ($userId == $page.getAttributeAsString("creator")) +<input type="checkbox" name="newContentVersion" checked="true" value="true"> Should be created a new content version? +#else +<input type="hidden" name="newContentVersion" value="true"> It will be created a new content version +#end +#end +</p> +<p> +itemclass = $page.getAttribute("ontologyclassname") +</p> + <p><input type="submit" name="_submit" value="Update Page"></p> <p><input type="submit" name="_submit" value="Add Language"> @@ -133,7 +153,6 @@ </form> </p> - <p> <h3>Page Update History</h3> <ul> --- NEW FILE: historywiki.html.en --- $portalPresenter.parse("$contextPath/pageheader.html", $portalRequest) <em><a href="index.html">Portal Component</a> - <a href="historywiki.html">List Wiki history Objects</a></em> <h1>List Wiki history Objects</h1> List of Wiki history pages stored in the database: #set ( $page = $portalPresenter.getPage($itemid) ) <ul> #foreach( $i in $itemManager.getContentVersions($corePresenter.parseInt($itemid), "$lang") ) <li>Name: <a href="$page.getPagePath()$page.getPageName()?lang=$lang&versionid=$i.get("versionid")">$page.getAttribute("name")</a> - Creatoruserid: $i.get("creatoruserid") - Version: $i.get("versionid") - Created: $i.get("creationtime") </li> #end </ul> $portalPresenter.parse("$contextPath/pagefooter.html", $portalRequest) |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:24:47
|
Update of /cvsroot/cobricks/cobricks2/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12177/web Added Files: pageheaderwiki.html pagefooterwiki.html pageheaderwiki.jsp pagefooterwiki.jsp Log Message: Wiki functionality added --- NEW FILE: pagefooterwiki.html --- #if ( $print != "true" ) <div align="right"> #if ($pitemid != "") <a href="$contextPath/portal/edit.html?itemid=$!pitemid&plang=$!pageLang">Edit Page</a> - #end <a href="$portalPresenter.getPrintLink($portalRequest)"> <font color="#808080"><img border="0" src="$contextPath/images/print_icon.gif"> Print Page</font></a> </div> </td> <td valign="top" width="100" class="right"> <br> <div class="box"> <div class="header"> <div class="title"> News </div> </div> <div class="body"> #set ($iresult = $!itemPresenter.searchItemsByCreationtime()) #if (($iresult)) #foreach ($i in $iresult) <div class="content notlast"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="$contextPath/images/item_icon.gif"> <a href="$contextPath/item/item.html?itemid=$!i.getId()">$!i.getTitle()</a> </span> <div class="boxDetails">$!i.getAttributeAsString("creationtime")</div> </div> #end #end </div> </div> <br> <div class="box"> <div class="header"> <div class="title"> New Users </div> </div> <div class="body"> #foreach ($i in $!userPresenter.searchUsers([], [], [], false, "history.org.cobricks.regtime desc", 10, "")) <div class="content notlast"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="$contextPath/images/user_icon.gif"> <a href="$contextPath/user/card.html?auserlogin=$i.getUserLogin()">$!i.getUserLogin()</a> </span> </div> #end </div> </div> </td> </tr> </table> <div align="right"><a href="$contextPath/privacypolicy.html">Privacy Policy</a> | <a href="$contextPath/info.html">Impressum</a> | <a href="$contextPath/info.html">About</a></div> #end </body> </html> --- NEW FILE: pageheaderwiki.html --- <html> <head> <meta http-equiv="Content-Type" content="text/html"> <meta name="Author" content="mic...@co..."> $portalPresenter.printHeader($portalRequest) <link rel="stylesheet" type="text/css" href="$contextPath/style.css"> <link rel="shortcut icon" href="http://www.cobricks.de/c2.png" type="image/png"> </head> <body bgcolor="#ffffff" topmargin="1" leftmargin="3" marginwidth="3" marginheight="1"> #set ( $print = "$!print" ) #if ( $print != "true" ) <table border="0" width="100%" cellpadding="4" cellspacing="0"> <tr bgcolor="#dfdfdf"> <td rowspan="2" align="left" valign="bottom" width="160"> <br> <a href="http://www.cobricks.org/"> <img border="0" src="$contextPath/images/cobricks2-logo.png" alt="Cobricks-2"></a> </td> <td colspan="2" align="right" valign="top"> <a href="$contextPath/index.html">Home</a> | <a href="$contextPath/ADMIN/index.html">Admin</a> | <a href="$contextPath/info.html">Help</a> <br><div style="margin:2px;">$portalPresenter.printLang($portalRequest)</div> </td> </tr> <tr bgcolor="#dfdfdf"> <td align="left" valign="bottom" width="95%"> <font size="+1"> <a href="$contextPath/index.html">HOME</a> | <a href="$contextPath/user/index.html">USER</a> | <a href="$contextPath/item/index.html">ITEM</a> | <a href="$contextPath/category/index.html">CATEGORY</a> | <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> </font> </td> </tr> </table> <table border="0" width="100%" cellpadding="4" cellspacing="4"> <tr> <td width="160" valign="top" bgcolor="#ffffff"> <!-- navigation column --> <table width="158" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="156" valign="top"> <table width="155" border="0" cellpadding="1" cellspacing="0"> <tr><td> <br> <div class="box"><div class="header"><div class="title"> Search</div></div> <div class="body"><div class="content last"> <span class="boxNavHeadline"> <div> <form action="$contextPath/search.html" method="post"> <input type="text" name="t" size="'+w+'" title="Please enter the search term in this field"><br> <table border="0"><tr><td valign="middle"> <select name="m" title="Please select the search domain from this list"> <option value="item" selected>Items</option> <option value="user">Users</option> </select> </td><td valign="middle"> <input type="submit" class="submit" value="Ok" title="Start Search"> </td></tr> </table> </form> <p> <img src="$contextPath/images/arrow.png"><a href="$contextPath/search.html">Extended Search</a> </div> </span> </div></div> <p> </p> <div class="box"><div class="header"><div class="title"> Login</div></div> <div class="body2"><div class="content last"> <span class="boxNavHeadline"> <div> #if ($!userLogin != "anonymous") You are logged in as<br> "<b>$!userLogin</b>" <p> <a href="$contextPath/user/user.html?auserlogin=$!userLogin"><img src="$contextPath/images/arrow.png" width="10" height="9" border="0">Your Profile</a><br> <a href="$contextPath/PORTAL?cmd=logout"><img src="$contextPath/images/arrow.png" width="10" height="9" border="0">Logout</a> #else <form name="loginForm" action="$contextPath/PORTAL" method="post"> <INPUT TYPE="hidden" NAME="cmd" VALUE="login"> <INPUT TYPE="hidden" NAME="cmd.success" VALUE="$contextPath/homepage.html"> <INPUT TYPE="hidden" NAME="cmd.error" VALUE="$contextPath/homepage.html"> Login<br> <input title="Please enter your login name" size="20" name="luserlogin" type="text"><br> Password<br> <input title="Please enter your password" size="16" name="luserpw" type="password"> <input class="submit" title="Login" value="Login" type="submit"><br> <input type=checkbox name="autologin" value="auto"> remember login </form> <p> <img src="$contextPath/images/arrow.png"> <a title="Send the password in an email" href="$contextPath/user/forgot_password.html">Forgot Password</a><br> <img src="$contextPath/images/arrow.png"> <a title="Register as new user" href="$contextPath/user/register.html">Register</a> #end </div> </span> </div></div> <p> </p> <!--Single Sign-On begin--> #set ($libertyBridge=$userManager.getLAIdffBridge()) #set ($role=$libertyBridge.getRole($portalRequest)) #if ("$!userLogin" == "anonymous" && "$!role" == "sp") <div class="box"> <div class="header"> <div class="title"> Single Sign-On </div> </div> <div class="body2"> <div class="content last"> <span class="boxNavHeadline"> <div> This Cobricks-2 installation acts as an Serviceprovider <br><br> Choose an Liberty Alliance identity provider:<br><br> #set ($idpList = $libertyBridge.getIdps($portalRequest)) #if (($idpList)) #foreach ($i in $idpList) <a href="/user/LibertyServlet?cmd=auth&providerID=$i.getName()">$i.getName()</a><br> #end #end </div> </span> </div> </div> #else #if($!userLogin != "anonymous") ##wenn durch Identitätsprovider angemeldet und die Bestätigung ##abgelaufen ist, Benutzer abmelden #if("$!role" == "sp") #set($curIdp=$libertyBridge.getCurrentIDP($portalRequest)) #if($curIdp) #set($date=$curIdp.getReauthenticateOnOrAfter()) #if($date) #if($libertyBridge.checkExpiration($date)) ##Bestätigung ist abgelaufen, auf PortalServlet weiterleiten um Logout zu machen ##Hier könnte man eine Seite als Parameter für den Aufruf von /PORTAL?cmd=logout ##über den Parameter cmd.sussess übergeben die dem User eine Meldung ausgibt. ##Funktioniert aber bei diesem cmd nicht. Dann würde aber auch eine ##Endlosschleife auftreten die man durch ein Flag umgehen müsste, z.B so ##set($returnPage="/user/la/expired.html?flag=1") ##set($adress="/PORTAL?cmd=logout&cmd.success=$returnPage") ##flag prüfen, sonst Endlosschleife ##set($flag=$request.getParameter("flag")) ##if(!$flag) ##forward auf PortalServlet ##end #set($adress="/PORTAL?cmd=logout") #set($request=$portalRequest.getHttpServletRequest()) #set($response=$portalRequest.getHttpServletResponse()) $request.getRequestDispatcher($adress).forward($request, $response) #end #end #end #end <div class="box"> <div class="header"> <div class="title"> Single Sign-On </div> </div> <div class="body2"> <div class="content last"> <span class="boxNavHeadline"> <div> #if("$!role" == "sp") This Cobricks-2 installation acts as an Serviceprovider <br><br> #set($currentIDP = $libertyBridge.getCurrentIDP($portalRequest)) #set($currentIDPName = $currentIDP.getName()) #if($currentIDPName) You are logged in through Liberty Alliance identity provider <b>"$currentIDPName"</b><br><br> #set($ex=$currentIDP.getReauthenticateOnOrAfter()) #if($ex) This session will expire at<br> $ex<br><br> #end Click <a href="/user/LibertyServlet?cmd=logout&providerID=$currentIDPName&userID=$!userLogin"> here </a> to make a global logout (this session and all session at third party serviceproviders made through $currentIDPName) #else You are logged in local #end <br><br> Click <a href="/user/la/managefederationssp.html"> here </a> to manage your federated identities #else This Cobricks-2 installation acts as an Liberty Alliance identity provider <br><br> Click <a href="/user/la/managefederationsidp.html"> here </a> to manage your federated identities #end </div> </span> </div> </div> #end #end <!--Single Sign-On end--> </td></tr> </table> </td></tr> </table> <!-- end of navigation column --> </td> <td> </td> <td valign="top" width="95%"> <font size="-1" color="red"> $portalPresenter.displayNotifications($sessionId) </font> <p> #end --- NEW FILE: pageheaderwiki.jsp --- <html> <%@ page language="java" session="true" import="org.cobricks.core.*,org.cobricks.user.*,org.cobricks.item.*,org.cobricks.context.*,org.cobricks.category.*,org.cobricks.message.*,org.cobricks.portal.*" %> <%! CoreManager coreManager = null; %> <%! UserManager userManager = null; %> <%! ItemManager itemManager = null; %> <%! ContextManager contextManager = null; %> <%! CategoryManager categoryManager = null; %> <%! MessageManager messageManager = null; %> <jsp:useBean id="jspHelper" class="org.cobricks.portal.JspHelper" scope="application"> <% jspHelper.init(config); %> </jsp:useBean> <% coreManager = jspHelper.getCoreManager(); %> <% userManager = (UserManager)jspHelper.getManager("userManager"); %> <% itemManager = (ItemManager)jspHelper.getManager("itemManager"); %> <% categoryManager = (CategoryManager)jspHelper.getManager("categoryManager"); %> <% contextManager = (ContextManager)jspHelper.getManager("contextManager"); %> <% messageManager = (MessageManager)jspHelper.getManager("messageManager"); %> <head> <title>Cobricks-2 JSP Test Page</title> <link rel="stylesheet" type="text/css" href="/style.css"> <link rel="shortcut icon" href="http://www.cobricks.de/c2.png" type="image/png"> </head> <body bgcolor="#ffffff" topmargin="1" leftmargin="3" marginwidth="3" marginheight="1"> <table border="0" width="100%" cellpadding="4" cellspacing="0"> <tr bgcolor="#dfdfdf"> <td rowspan="2" align="left" valign="bottom" width="160"> <br> <a href="http://www.cobricks.org/"> <img border="0" src="/images/cobricks2-logo.png" alt="Cobricks-2"></a> </td> <td colspan="2" align="right" valign="top"> <a href="/index.html">Home</a> | <a href="/ADMIN/index.html">Admin</a> | <a href="/info.html">Help</a> <br><div style="margin:2px;">$portalPresenter.printLang($portalRequest)</div> </td> </tr> <tr bgcolor="#dfdfdf"> <td align="left" valign="bottom" width="95%"> <font size="+1"> <a href="/index.html">HOME</a> | <a href="/user/index.html">USER</a> | <a href="/item/index.html">ITEM</a> | <a href="/category/index.html">CATEGORY</a> | <a href="/context/index.html">CONTEXT</a> | <a href="/message/index.html">MESSAGE</a> | <a href="/portal/index.html">PORTAL</a> </font> </td> </tr> </table> <table border="0" width="100%" cellpadding="4" cellspacing="4"> <tr> <td width="160" valign="top" bgcolor="#ffffff"> <!-- navigation column --> <table width="158" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="156" valign="top"> <table width="155" border="0" cellpadding="1" cellspacing="0"> <tr><td> <br> <div class="box"><div class="header"><div class="title"> Search</div></div> <div class="body"><div class="content last"> <span class="boxNavHeadline"> <div> <form action="/search.html" method="post"> <input type="text" name="t" size="'+w+'" title="Please enter the search term in this field"><br> <table border="0"><tr><td valign="middle"> <select name="m" title="Please select the search domain from this list"> <option value="item" selected>Items</option> <option value="user">Users</option> </select> </td><td valign="middle"> <input type="submit" class="submit" value="Ok" title="Start Search"> </td></tr> </table> </form> <p> <img src="/images/arrow.png"><a href="/search.html">Extended Search</a> </div> </span> </div></div> <p> </p> <div class="box"><div class="header"><div class="title"> Login</div></div> <div class="body2"><div class="content last"> <span class="boxNavHeadline"> <div> You are registered as<br> "<b>$!userLogin</b>" <p> <a href="/user/user.html?auserlogin=$!userLogin"><img src="/images/arrow.png" width="10" height="9" border="0">Your Profile</a><br> <a href="/PORTAL?cmd=logout"><img src="/images/arrow.png" width="10" height="9" border="0">Logout</a> </div> </span> </div></div> </td></tr> </table> </td></tr> </table> <!-- end of navigation column --> </td> <td> </td> <td valign="top" width="95%"> --- NEW FILE: pagefooterwiki.jsp --- </td> <td valign="top" width="100" class="right"> <br> <div class="box"> <div class="header"> <div class="title"> News </div> </div> <div class="body"> <div class="content notlast"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="/images/item_icon.gif"> <a href="">Mitteilungs-Titel</a> </span> <div class="boxDetails">12.1.2004</div> </div> <div class="content notlast"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="/images/item_icon.gif"> <a href="">Mitteilungs-Titel</a> </span> <div class="boxDetails">12.1.2004</div> </div> </div> </div> <br> <div class="box"> <div class="header"> <div class="title"> New Users </div> </div> <div class="body"> <div class="content notlast"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="/images/item_icon.gif"> <a href="">Userid</a> </span> <div class="content notlast"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="/images/item_icon.gif"> <a href="">Userid</a> </span> <div class="content last"> <span class="boxNavHeadline"> <img alt="" width="16" height="16" src="/images/item_icon.gif"> <a href="">Userid</a> </span> </div> </div> </div> </td> </tr> </table> <div align="right"><a href="">Impressum</a> | <a href="">About</a></div> #end </body> </html> |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:24:11
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12049/src/org/cobricks/portal Modified Files: PortalManagerImpl.java itemontology.xml PortalServlet.java Log Message: Wiki functionality added Index: PortalServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalServlet.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- PortalServlet.java 20 Dec 2005 18:10:24 -0000 1.40 +++ PortalServlet.java 16 Jan 2006 09:23:58 -0000 1.41 @@ -96,7 +96,7 @@ */ public void init(ServletConfig config) throws ServletException - { + { super.init(config); String tmps = null; @@ -238,7 +238,7 @@ + args); bridge.removeProviderSessions(args); } - + // end - Liberty Alliance Single Sign On // everything went well ... @@ -327,7 +327,18 @@ if (fullcontext != null) { attrs.put("fullcontext", fullcontext); } - + + //TODO AGA: Erweiterung + //If the page should be versiond + String createwikipage = prequest.getRequestParameter("createwikipage"); + createwikipage = (createwikipage == null) ? "" : createwikipage; + if (createwikipage.equals("true")) { + attrs.put("createwikipage", "true"); + } else { + attrs.put("createwikipage", "false"); + } + //ENDE + try { int itemid = portalManager.createPage(pagepath, pagename, attrs, @@ -469,6 +480,20 @@ } try { + //TODO AGA Should be created a new content version + String newContentVersion = prequest. + getRequestParameter("newContentVersion"); + + newContentVersion = (newContentVersion == null) ? "" : + newContentVersion; + if(newContentVersion.equals("true")) { + attrs.put("newContentVersion", "true"); + logger.info("AGA updatePage: new Wiki Version"); + } else { + attrs.put("newContentVersion", "false"); + logger.info("AGA updatePage: no new Wiki Version"); + } + //ENDE portalManager.updatePage(itemid, attrs, portalUser.getUser()); String hostname = request.getRemoteHost(); Index: PortalManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalManagerImpl.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- PortalManagerImpl.java 3 Jan 2006 09:36:18 -0000 1.69 +++ PortalManagerImpl.java 16 Jan 2006 09:23:57 -0000 1.70 @@ -58,6 +58,7 @@ import org.cobricks.core.util.LogUtil; import org.cobricks.item.Item; import org.cobricks.item.ItemManager; +import org.cobricks.portal.wiki.Utility; import org.cobricks.user.AccessControl; import org.cobricks.user.AccessHandler; import org.cobricks.user.User; @@ -382,10 +383,27 @@ String pagePath = portalRequest.getPagePath(); String pageName = portalRequest.getPageName(); String lang = portalRequest.getLang(); - PortalPage page = getPage(pagePath, pageName); + + //Versionid of the page + Integer versionid = null; + //Language of the page + String pageLanguage = null; - // check access rights + String itemclass = null; + try { + itemclass = (String)page.getAttribute("itemclass"); + + //Get verseionid of page + versionid = Integer.valueOf( + portalRequest.getRequestParameter("versionid")); + //Get language of the page + pageLanguage = (String)portalRequest.getRequestParameter("lang"); + } catch (Exception e) { + versionid = null; + } + + // check access rights boolean access = true; // TBD if (!access) { @@ -393,9 +411,46 @@ pageName = "noaccess.html"; page = getPage(pagePath, pageName); } + + Map pc = null; + + if(itemclass != null && itemclass.equals("wikipage")) { + pc = new HashMap(); + String content = null; + if (versionid != null) { + content = itemManager.getContentVersion( + page.getLocalId(), lang, versionid.intValue()); + if(content == null) { + content = itemManager.getContentVersion( + page.getLocalId(), defaultLanguage, versionid.intValue()); + } + } else { + content = this.getHighestContentVersion( + page.getLocalId(), lang); + if(content == null) { + content = this.getHighestContentVersion( + page.getLocalId(), defaultLanguage); + } + } + if (content != null) { + + //Parse the wiki-content + content = Utility.parse(content); +// content = content+"<br>"; +// content = Utility.insertEditLink(page.getLocalId(), +// content, content.length()); +// content = content+"<br>"; +// content = Utility.insertHistoryLink(page.getLocalId(), lang, +// content, content.length()); +// content = Utility.deleteToken(content); + + pc.put(pageLanguage, content); + } + } else { + // get page content + pc = page.getStringPageContent(lang); + } - // get page content - Map pc = page.getStringPageContent(lang); if (pc == null || pc.size()<1) { if (!pageName.equals("favicon.ico")) logger.warn("Failed getting content for page "+pagePath+pageName @@ -443,6 +498,40 @@ } + /** + * Gets the highest content version to the itemid. + * @param itemid The id for the content version. + * @param lang Language for the content. + * @return Returns the content of the highest versionid if exist, otherwise + * null. + */ + private String getHighestContentVersion(int itemid, String lang) { + List contentList = itemManager.getContentVersions(itemid, lang); + String content = null; + Integer versionid = null; + int highestVersionid = -1; + + if (contentList == null) { + return null; + } + + for(Iterator i = contentList.iterator(); i.hasNext();) { + Map mapElement = (Map)i.next(); + if(mapElement.get("versionid") != null) { + versionid = (Integer)mapElement.get("versionid"); + if (versionid.intValue() > highestVersionid) { + highestVersionid = versionid.intValue(); + if(mapElement.get("content") != null) { + content = (String)mapElement.get("content"); + } else { + content = null; + } + + } + } + } + return content; + } /* -------------------------------------------------------------------- */ /* database access @@ -494,7 +583,7 @@ languages.add("fr"); languages.add("it"); return languages; - + } /** @@ -526,19 +615,26 @@ List items = itemManager.searchItems(xpath); if (items != null && items.size()>0) throw new CobricksException("portal", "exists", ""); - - // check if the pagename and pagepath would be a valid url - String url = "http://localhost" + pagePath + pageName; - Pattern urlPattern = - Pattern.compile("(?:https?|ftp)://[^\\s,<>\\?]+?\\.[^\\s,<>\\?]+"); - Matcher m = urlPattern.matcher(url); - if (!m.find()) - throw new CobricksException("portal", "invalidURL", ""); + + // check if the pagename and pagepath would be a valid url +// String url = "http://localhost" + pagePath + pageName; +// Pattern urlPattern = +// Pattern.compile("(?:https?|ftp)://[^\\s,<>\\?]+?\\.[^\\s,<>\\?]+"); +// Matcher m = urlPattern.matcher(url); +// if (!m.find()) +// throw new CobricksException("portal", "invalidURL", ""); // create new item object Item item = null; try { - attrs.put("itemclass", "portalpagehtml"); + //If should be created a wiki-page + String createwikipage = (String)attrs.remove("createwikipage"); + if (createwikipage.equals("true")) { + attrs.put("itemclass", "wikipage"); + } else { + attrs.put("itemclass", "portalpagehtml"); + } + attrs.put("name", pageName); attrs.put("mimetype", "text/html"); Set folders = new HashSet(); @@ -577,11 +673,13 @@ if (page == null) return; page.updateFromMap(attrs); - + if (updater == null) itemManager.updateItem(page, 0); - else + else { + page.setAttribute("updater", new User(updater.getUserId())); itemManager.updateItem(page, updater.getUserId()); + } portalStats.addPageUpdate(page.getPagePath(), page.getPageName()); } @@ -1090,7 +1188,7 @@ protected void getDirNames(File f, String path, Set dirnames) { File[] fileArr = f.listFiles(); - if (fileArr == null || fileArr.length<1) return; + if (fileArr == null || fileArr.length<1) return; for (int i=0; i<fileArr.length; i++) { if (fileArr[i].isDirectory()) { String newPath = path + (fileArr[i].getName()) + "/"; @@ -1115,7 +1213,7 @@ } return "error"; } - + public String createPortalCategory(Map attrs, User creator) { try { @@ -1127,7 +1225,7 @@ } return "error"; } - + public List getPagesWithPageCategory(int pagecategory_id) { String xpathQuery = @@ -1135,7 +1233,7 @@ +"and /item[pagecategories/category/id=" + pagecategory_id + "]"; return itemManager.searchItems(xpathQuery); } - + public List getPagesWithPortalCategory(int portalcategory_id) { String xpathQuery = @@ -1143,7 +1241,7 @@ +"and /item[portalcategory/id=" + portalcategory_id + "]"; return itemManager.searchItems(xpathQuery); } - + public List searchPages(String searchExp, boolean searchInTitle) { @@ -1153,7 +1251,7 @@ String searchWord = searchExp; searchWord = searchWord.toLowerCase(); - String query = ""; + String query = ""; if (searchInTitle == true) { query = "/item[itemclass~'portalpagehtml'] and /item[(" + "contains(translate(content, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') or " + Index: itemontology.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/itemontology.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- itemontology.xml 22 Aug 2005 13:52:07 -0000 1.15 +++ itemontology.xml 16 Jan 2006 09:23:58 -0000 1.16 @@ -18,4 +18,12 @@ </attr> </class> +<class name="wikipage" parent="portalpage"> +<description lang="de">Wikiseite</description> +<attr name="content" type="text" multilanguage="true" versioned="true" /> +<attr name="creatoruserid" type="int" /> +<attr name="versionid" type="int" /> +<attr name="creationtime" type="datetime" /> +</class> + </itemontology> |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:23:53
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12000/src/org/cobricks/item Modified Files: ItemManagerImpl.java ItemManager.java Item.java Log Message: Wiki functionality added Index: ItemManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManager.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ItemManager.java 20 Dec 2005 10:25:30 -0000 1.27 +++ ItemManager.java 16 Jan 2006 09:23:44 -0000 1.28 @@ -15,7 +15,6 @@ import java.util.Date; import java.util.Map; import java.util.List; -import java.util.ArrayList; import org.cobricks.core.CobricksException; import org.cobricks.core.ComponentManagerInterface; @@ -28,7 +27,12 @@ * * @author mic...@ac... * @author ma...@in... +<<<<<<< ItemManager.java + * @author Alexander Gafriller - gaf...@in... + * @version $Date$ +======= * @version $Date$ +>>>>>>> 1.27 */ public interface ItemManager extends ComponentManagerInterface @@ -267,5 +271,34 @@ */ List sortItemsByAttribute(List itemList, String orderAttribute); - + /** + * Search a list of all content versions in the correct language and + * with the itemid passed through. + * @param itemid The id for the content version + * @param lang Language for the content + * @return The result list contains Maps with the following attribute-value + * pairs: (Integer versionid, Date creationdate, Integer creator). + */ + List getContentVersions(int itemid, String lang); + + /** + * Search a content for a specific version. + * @param itemid The id for the content version + * @param lang Language for the content + * @param versionid The version of the content + * @return The result contains the contant if it exist + * otherwise null. + */ + String getContentVersion(int itemid, String lang, int versionid); + + /** + * Create a new version of the content and return the new versionid. + * @param itemid The id for the content version. + * @param lang Language for the content. + * @param content The content witch will be stored. + * @param creator User that want to create the new content version. + * @return Returns a new versionid of the content if it was created + * otherwise -1. + */ + int createContentVersion(int itemid, String lang, String content, User creator); } Index: Item.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/Item.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- Item.java 22 Aug 2005 13:52:06 -0000 1.48 +++ Item.java 16 Jan 2006 09:23:44 -0000 1.49 @@ -17,9 +17,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- ItemManagerImpl.java 3 Jan 2006 09:33:34 -0000 1.61 +++ ItemManagerImpl.java 16 Jan 2006 09:23:44 -0000 1.62 @@ -32,9 +32,9 @@ import java.util.HashSet; import java.util.List; import java.util.Properties; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +//import java.util.StringTokenizer; +//import java.util.regex.Matcher; +//import java.util.regex.Pattern; import org.apache.log4j.Logger; @@ -66,7 +66,21 @@ * relational database only. * * @author mic...@ac... +<<<<<<< ItemManagerImpl.java +<<<<<<< ItemManagerImpl.java +<<<<<<< ItemManagerImpl.java + * @author Alexander Gafriller - gaf...@in... + * + * @version $Date$ +======= + * @version $Date$ +>>>>>>> 1.58 +======= * @version $Date$ +>>>>>>> 1.60 +======= + * @version $Date$ +>>>>>>> 1.61 * * @see org.cobricks.item.ItemManager */ @@ -333,11 +347,11 @@ { Item result = null; OntologyClass oc = this.getOntology().getClass(itemclass); - if (oc == null) { // should not happen ... - logger.warn("Did not find item ontology information for " - + itemclass+". Using default item class."); - oc = this.getOntology().getClass("item"); - } + if (oc == null) { // should not happen ... + logger.warn("Did not find item ontology information for " + + itemclass+". Using default item class."); + oc = this.getOntology().getClass("item"); + } String javaclass = oc.getJavaClassName(); // instantiate class try { @@ -943,6 +957,23 @@ int itemid = insertMainTable(attrs, globalid, itemClassName); + String contentName = null; + String content = null; + int versionid = -1; + + if (itemClassName.equals("wikipage")) { + String lang = (String)attrs.get("lang"); + if (lang == null || lang.equals("")) + lang = this.getDefaultLanguage(); + User creatoruserid = (User)attrs.get("creator"); + contentName = "content_"+lang; + content = (String)attrs.remove(contentName); + + //Create new Wiki version + versionid = this.createContentVersion(itemid, + lang, content, creatoruserid); + } + // Insert the other attributes Iterator i = attrs.keySet().iterator(); while (i.hasNext()) { @@ -954,6 +985,9 @@ } } + if((content != null) && (contentName != null)) + attrs.put(contentName, content); + // create item object and initialize it Item it = createItemObject(itemClassName); it.setLocalId(itemid); @@ -1462,6 +1496,7 @@ recordset.put("avalue", avalue); recordset.put("aname", aname); } + return recordset; } @@ -1528,7 +1563,7 @@ { // and now retrieve the annotations ... String sql = - "select * from item_annotation where itemid = "+item.getId(); + "select * from item_annotation where itemid = "+item.getId(); List results = dbAccess.sqlQuery(sql); Iterator i = results.iterator(); while (i.hasNext()) { @@ -1791,6 +1826,17 @@ java.util.Calendar cal = java.util.Calendar.getInstance(); java.util.Date start = cal.getTime(); + String newContentVersion = item.getAttributeAsString("newContentVersion"); + item.removeAttribute("newContentVersion"); + + newContentVersion = (newContentVersion == null) ? "" : + newContentVersion; + + boolean createNewContentVersion = false; + if(newContentVersion.equals("true")) { + createNewContentVersion = true; + } + // I. Handle the two item ids String globalid = item.getGlobalId(); int itemid = item.getLocalId(); @@ -1861,11 +1907,48 @@ while (ite.hasNext()) { String aname = (String) ite.next(); if (!ItemAttrs.attributeIsInMainTable(aname)) { - this.updateAttribute(itemid, aname, - attrs.get(aname), - oldAttrs.get(aname), - itemclass, - oldItemclass); + if(aname.matches("content_..")) { + String lang = aname.substring(8); + //Content to update + String content = (String)attrs.get(aname); + if (content == null) { + content = ""; + } + if (createNewContentVersion) { + Object obj = item.getAttribute("updater"); + + //Attention of the type of obj + User createUser = null; + if(obj instanceof Integer) { + createUser = (obj == null) ? new User(0) + : new User(((Integer)obj).intValue()); + } else { + if (obj instanceof User) { + createUser = (obj == null) ? new User(0) + : (User)obj; + } + } + + if (createUser == null) { + logger.warn("User is NULL, could not create a " + + "new content-version"); + } + //Create new content version + int versionId = this.createContentVersion( + itemid, + lang, + content, + createUser); + } else { //Change only the highest content version + updateHighestContentVersion(itemid, lang, content); + } + } else { + this.updateAttribute(itemid, aname, + attrs.get(aname), + oldAttrs.get(aname), + itemclass, + oldItemclass); + } } } @@ -1874,9 +1957,19 @@ while (ite.hasNext()) { String aname = (String) ite.next(); if (!ItemAttrs.attributeIsInMainTable(aname)) { - this.insertAttribute(itemid, aname, - attrs.get(aname), - itemclass); + //Create new content version + if(aname.matches("content_..") && createNewContentVersion) { + String lang = aname.substring(8); + int versionId = this.createContentVersion( + itemid, + lang, + (String)attrs.get(aname), + (User)attrs.get("updater")); + } else { + this.insertAttribute(itemid, aname, + attrs.get(aname), + itemclass); + } } } itemCache.updateItem(item); @@ -2122,7 +2215,7 @@ throws CobricksException { StringBuffer sql = new StringBuffer("select itemid "); - if (aname != null && !aname.equals("")) + if (aname != null && !aname.equals("")) sql.append(", " + aname); sql.append(" from item where itemid > 0 "); if (lowerthan) { @@ -2216,7 +2309,7 @@ * to create an ItemAttachment * @param itemid * @param itemaid - * @param title + * @param title * @param comment * @param mimetype * @param size @@ -2441,5 +2534,190 @@ } item.deleteAllAttachments(); } + + /** + * @see org.cobricks.item.ItemManager#getContentVersions(int, String) + */ + public List getContentVersions(int itemid, String lang) + { + //If lang isn't set use defaultLanguage + if (lang == null) { + return null; + } + + //Search the content versions in the db + HashMap conditions = new HashMap(); + conditions.put("itemid=", new Integer(itemid)); + conditions.put("lang=", new String("'"+lang+"'")); + + List fields = new java.util.LinkedList(); + fields.add("versionid"); + fields.add("creationtime"); + fields.add("creatoruserid"); + fields.add("content"); + + List result = dbAccess.sqlSelect("item_content", conditions, fields); + + if (result.isEmpty()) { + logger.info("No content versions found for given itemid " + + Integer.toString(itemid) + " and given language " + lang); + + return null; + } else { + return result; + } + } + + /** + * @see org.cobricks.item.ItemManager#getContentVersion(int, String, int) + */ + public String getContentVersion(int itemid, String lang, int versionid) + { + if (lang == null || lang.equals("")) { + return null; + } + + String sql = + "SELECT content " + + "FROM item_content " + + "WHERE itemid = "+itemid + + " and lang = '"+lang+"'" + + " and versionid = "+versionid; + + List result = dbAccess.sqlQuery(sql); + + if (result.isEmpty()) { + logger.info( + "No content found for given itemid " + Integer.toString(itemid) + + ", language " + lang + + " and versionid " + Integer.toString(versionid)); + return null; + } else { + return ((String) ((Map) result.get(0)).get("content")); + } + } + /** + * @see org.cobricks.item.ItemManager#createContentVersion(int, String, String, User) + */ + public int createContentVersion(int itemid, String lang, String content, User creator) + { + //If lang isn't set use defaultLanguage + if (lang == null) { + lang = this.getDefaultLanguage(); + } + //If content isn't set, write "" in the db + if (content == null) { + content = ""; + } + + //Get the currently date + Date date = new Date(); + + //Get the versionid + Integer versionid = null; + + String sql = + "select max(versionid) " + + " from item_content " + + " where itemid = " + itemid + + " and lang = '" + lang + "'"; + + List result = dbAccess.sqlQuery(sql); + if(result.isEmpty()) { + versionid = new Integer(0); + } else { + versionid = (Integer)((Map)result.get(0)).get("max(versionid)"); + versionid = (versionid == null) ? new Integer(0) : versionid; + } + Integer newVersionId = new Integer(versionid.intValue()+1); + + Map attrs = new java.util.HashMap(); + attrs.put("itemid", "" + itemid); + attrs.put("creatoruserid", new Integer(creator.getUserId())); + attrs.put("creationtime", date); + attrs.put("lang", lang); + attrs.put("content", content); + attrs.put("versionid", newVersionId); + + int aid = this.dbAccess.sqlInsert("item_content", attrs); + + if (aid > 0) { + logger.info("New content version created"); + return versionid.intValue(); + } else { + logger.warn("Failed getting new versionid ..."); + return -1; + } + } + + /** + * Override the content with the highest versionid. + * @param itemid The id for the content version. + * @param lang Language for the content. + * @param content New content to store. + */ + private void updateHighestContentVersion(int itemid, String lang, String content) + { + //Get the versionid + Integer versionid = null; + + String sql = + "select max(versionid) " + + " from item_content " + + " where itemid = " + itemid + + " and lang = '" + lang + "'"; + + List result = dbAccess.sqlQuery(sql); + if(!result.isEmpty()) { + versionid = (Integer)((Map)result.get(0)).get("max(versionid)"); + } + + if (versionid == null) { + logger.warn("updateHighestContentVersion: There is no versioned " + + "content stored. The new content was not stored."); + return; + } + String whereConditions = "itemid = " + itemid + + " and lang = " + "'" + lang + "'" + + " and versionid = " + versionid.intValue(); + + Map attrs = new java.util.HashMap(); + attrs.put("content", content); + + this.dbAccess.sqlUpdate("item_content", attrs, whereConditions); + } + + /** + * Gets the highest content version to the itemid. + * @param itemid The id for the content version. + * @param lang Language for the content. + * @return Returns the content of the highest versionid if exist, otherwise + * null. + */ + private String getHighestContentVersion(int itemid, String lang) + { + //Get the versionid + Integer versionid = null; + + String sql = + "select max(versionid) " + + " from item_content " + + " where itemid = " + itemid + + " and lang = '" + lang + "'"; + + List result = dbAccess.sqlQuery(sql); + if(!result.isEmpty()) { + versionid = (Integer)((Map)result.get(0)).get("max(versionid)"); + } + + if (versionid == null) { + logger.warn("updateHighestContentVersion: There is no versioned " + + "content stored. The new content was not stored."); + return null; + } + + return getContentVersion(itemid, lang, versionid.intValue()); + + } } |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:23:37
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11971/src/org/cobricks/portal/wiki Added Files: UtilityTest.java Utility.java Log Message: Wiki functionality added --- NEW FILE: UtilityTest.java --- /* * @author Alexander Gafriller * @version 1.0.0 * Erzeugt am: 14.12.2005 * */ package org.cobricks.portal.wiki; import junit.framework.TestCase; import org.cobricks.portal.wiki.Utility; /** * Erzeugt am: 14.12.2005 * */ public class UtilityTest extends TestCase { public void testParse() { String retValue; String parse; String result; //Single tests //italic parse = "Italic: ''italic''"; result = "Italic: <i>italic</i>"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); parse = "Italic: ''italic\n"; result = "Italic: <i>italic</i>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "Italic: ''italic"; result = "Italic: <i>italic</i>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //Bold parse = "Bold: '''bold'''"; result = "Bold: <b>bold</b>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "Bold: '''bold\n"; result = "Bold: <b>bold</b>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "Bold: '''bold"; result = "Bold: <b>bold</b>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //italic and bold parse = "Italic and bold: '''''italic and bold'''''"; result = "Italic and bold: <i><b>italic and bold</b></i>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //heading parse = "==heading=="; result = "<h1>heading</h1>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "==heading\n"; result = "<h1>heading</h1>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "==heading"; result = "<h1>heading</h1>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //sub heading parse = "===sub heading==="; result = "<h2>sub heading</h2>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "===sub heading\n"; result = "<h2>sub heading</h2>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "===sub heading"; result = "<h2>sub heading</h2>"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //Non numbered list //Only this case does nor exist parse = "** two-one\n" + "** two-two\n" + "** two-three\n"; result = "</li><ul><li> two-one</li><li> two-two</li>" + "<li> two-three</li></ul>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "** two-one\n" + "** two-two\n" + "** two-three"; result = "</li><ul><li> two-one</li><li> two-two</li>" + "<li> two-three</li></ul>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "* one\n" + "* two\n" + "* three\n"; result = "<ul><li> one</li><li> two</li><li> three</li></ul>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "* one\n" + "* two\n" + "* three"; result = "<ul><li> one</li><li> two</li><li> three</li></ul>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //Nested non numbered lists parse = "* one\n" + "* two\n" + "** two-one\n" + "** two-two\n" + "* three\n"; result = "<ul><li> one</li>" + "<li> two</li>" + "<ul><li> two-one</li>" + "<li> two-two</li></ul>" + "<li> three</li></ul>\n"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); //Nested non numbered lists parse = "* one\n" + "* two\n" + "** two-one\n" + "** two-two\n" + "* three"; result = "<ul><li> one</li>" + "<li> two</li>" + "<ul><li> two-one</li>" + "<li> two-two</li></ul>" + "<li> three</li></ul>\n"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); //Nested non numbered lists parse = "* one\n" + "* two\n" + "** two-one\n" + "** two-two\n" + "* three\n" + "* four\n" + "** four-one\n" + "** four-two\n" + "** four-three\n" + "* five\n"; result = "<ul><li> one</li>" + "<li> two</li>" + "<ul><li> two-one</li>" + "<li> two-two</li></ul>" + "<li> three</li>" + "<li> four</li>" + "<ul><li> four-one</li>" + "<li> four-two</li>" + "<li> four-three</li></ul>" + "<li> five</li></ul>\n"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); //Nested non numbered lists parse = "* one\n" + "* two\n" + "** two-one\n" + "** two-two" + "* three\n" + "* four\n" + "** four-one" + "** four-two\n" + "** four-three\n" + "* five"; result = "<ul><li> one</li>" + "<li> two</li>" + "<ul><li> two-one</li>" + "<li> two-two" + "* three</li></ul>" + "<li> four</li>" + "<ul><li> four-one" + "** four-two</li>" + "<li> four-three</li></ul>" + "<li> five</li></ul>\n"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); //Nested non numbered lists parse = "* one\n" + "* two\n" + "** two-one\n" + "** two-two\n" + "* three\n" + "* four\n" + "** four-one\n" + "** four-two\n" + "** four-three\n" + "** four-four\n"; result = "<ul><li> one</li>" + "<li> two</li>" + "<ul><li> two-one</li>" + "<li> two-two</li></ul>" + "<li> three</li>" + "<li> four</li>" + "<ul><li> four-one</li>" + "<li> four-two</li>" + "<li> four-three</li>" + "<li> four-four</li></ul></ul>\n"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); //numbered lists //only this case does not exist parse = "## two-one\n" + "## two-two\n" + "## two-three\n"; result = "</li><ol><li> two-one</li><li> two-two</li>" + "<li> two-three</li></ol>\n"; retValue = Utility.parse(parse); // System.out.println(result); // System.out.println(retValue); assertTrue(result.equals(retValue)); parse = "# one\n" + "# two\n" + "# three\n"; result = "<ol><li> one</li><li> two</li><li> three</li></ol>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); parse = "# one\n" + "# two\n" + "# three\n"; result = "<ol><li> one</li><li> two</li><li> three</li></ol>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //Nested numbered lists parse = "# one\n" + "# two\n" + "## two-one\n" + "## two-two\n" + "# three\n"; result = "<ol><li> one</li>" + "<li> two</li>" + "<ol><li> two-one</li>" + "<li> two-two</li></ol>" + "<li> three</li></ol>\n"; retValue = Utility.parse(parse); assertTrue(result.equals(retValue)); //Nested numbered lists parse = "# one\n" + "# two\n" + "## two-one\n" + "## two-two\n" + "# three\n" + "# four\n" + "## four-one\n" + "## four-two\n" + "# five\n"; result = "<ol><li> one</li>" + "<li> two</li>" + "<ol><li> two-one</li>" + "<li> two-two</li></ol>" + "<li> three</li>" + "<li> four</li>" + "<ol><li> four-one</li>" + "<li> four-two</li></ol>" + "<li> five</li></ol>\n"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); //indent parse = "Normal text\n" + ": indented\n" + ":: double indented\n" + ":: double indented 2\n"; result = "Normal text" + "<dl><dd> indented</dd>" + "<dl><dd> double indented</dd>" + "<dd> double indented 2</dd></dl>" + "</dl>\n"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); //No wiki syntax parse = "Normal '''text''' without sense ==heading== and " + "<nowiki>No '''wiki''' syntax * to # test</nowiki>"; result = "Normal <b>text</b> without sense <h1>heading</h1> and " + "No '''wiki''' syntax * to # test"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); //Links to a WIKI page parse = "Test the links: " + "A simple link [[FAQ]]"; result = "Test the links: " + "A simple link " + "<a href=\"$portalRequest.getBaseUrl()FAQ.html\">FAQ</a>"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); parse = "The same link with another name " + "[[FAQ|frequently asked questions]]"; result = "The same link with another name " + "<a href=\"$portalRequest.getBaseUrl()FAQ.html\">" + "frequently asked questions</a>"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); //Weblinks parse = "Weblinks: " + "[[http://www.google.de/]] - description" + "[[http://www.google.de/|Google]]"; result = "Weblinks: " + "<a href=\"http://www.google.de/\">" + "http://www.google.de/</a> - description" + "<a href=\"http://www.google.de/\">Google</a>"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); //Imagelink parse = "Imagelink: " + "[[wikibild.jpg|Image]]"; result = "Imagelink: " + "<a href=\"$portalRequest.getBaseUrl()/wikibild.jpg\">" + "Image</a>"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); //Images parse = "Image: " + "[[:img:wikibild.jpg|Image]]"; result = "Image: " + "<img src=\"$portalRequest.getBaseUrl()/wikibild.jpg\" " + "alt=\"Image\">"; retValue = Utility.parse(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); } public void testDeleteToken() { String parse, result, retValue; //Delete parse = "This text $portalPresenter.parse(\"" + "$contextPath/pageheader.html\", $portalRequest)should be" + "$portalPresenter.parse(\"" + "$contextPath/pagefooter.html\", $portalRequest) coherent." + "$portalPresenter.parse(\"" + "$contextPath/pageheader.html\", $portalRequest)"; result = "This text should be coherent."; retValue = Utility.deleteToken(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); } public void testDeleteComments() { String parse, result, retValue; //Delete comments parse = "Delete comments: first <!-- first comment -->" + "'''second''' <!-- comment text -->" + "third text <!-- ''italic'' -->" + "delete open, but new line <!-- open comment\n" + "comment\n" + "and one with file end <!-- file end comment "; result = "Delete comments: first " + "'''second''' " + "third text " + "delete open, but new line \n" + "comment\n" + "and one with file end "; retValue = Utility.deleteComments(parse); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); } public void testInsertEditLink() { String parse, result, retValue; int itemid = 3; //Insert the edit link parse = "Edit this page: "; result = "Edit this page: " + "<a href=\"portal/edit.html?itemid=3\">Edit</a>"; retValue = Utility.insertEditLink(itemid, parse, parse.length()); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); } public void testInsertHistoryLink() { String parse, result, retValue, lang = "en"; int itemid = 3; //Insert the edit link parse = "History of the page: "; result = "History of the page: " + "<a href=\"portal/historywiki.html?itemid=3&lang=en\">" + "History</a>"; retValue = Utility.insertHistoryLink(itemid, lang, parse, parse .length()); //System.out.println(result); //System.out.println(retValue); assertTrue(result.equals(retValue)); } } --- NEW FILE: Utility.java --- /* * Copyright (c) 2003-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.portal.wiki; import java.util.Map; import java.util.HashMap; /** * Makes some functionality available to parse the wiki pages. It translate * the wiki-tokens into HTML. * @author gaf...@in... * @version $Date: 2006/01/16 09:23:28 $ * */ public class Utility { //Indicate the end of line in the String private final static String ENDOFLINE = "\n"; //Default ending of a file private final static String DEFAULTENDING = "html"; private final static String ITEMID = "%ITEMID%"; private final static String LANG = "%LANG%"; //Link to edit the page - the itemid must be replaced private final static String EDITLINK = "<a href=\"portal/edit.html?itemid="+ ITEMID+"\">Edit</a>"; //Link to history of the page private final static String HISTORYLINK = "<a href=\"" + "portal/historywiki.html?" + "itemid="+ITEMID+"&lang="+LANG+"\">History</a>"; //Indicate the begin of the text, that will not be changed private final static String BEGINNOWIKITEXT = "<nowiki>"; //Indicate the end of the text, that will not be changed private final static String ENDNOWIKITEXT = "</nowiki>"; //Contains the text, that will not be changed private static Map noWikiTextMap = new HashMap(); // Contains the token, which will searched in the content to exchange private static String[] searchToken = null; // Contains the token, which refer to the whole line private static String[] searchTokenWholeLine = null; // Contains the token, which will be replaced instead of the search token private static Map exchangeTokenMap = null; //Links private final static String BEGINLINK = "[["; private final static String ENDLINK = "]]"; private final static String SEPARATORLINK = "|"; //Image private final static String BEGINIMG = "[[:img:"; private final static String ENDIMG = "]]"; private final static String SEPARATORIMG = "|"; //Comments private final static String BEGINCOMMENT = "<!--"; private final static String ENDCOMMENT = "-->"; //delete this token private static String[] deleteToken = null; /** * Initialize the lists with the strings to search in the parse Sting. */ private static void initialize() { //Text formatting String[] searchTokenTmp = {"'''''", "'''", "''", "===", "=="}; //Token which refer to the whole line String[] searchTokenWholeLineTmp = {"**", "*", "##", "#", "::", ":"}; //Elements which will be exchanged exchangeTokenMap = new HashMap(); //Italic and bold exchangeTokenMap.put("'''''", "<i><b>"); exchangeTokenMap.put("/'''''","</b></i>"); //bold exchangeTokenMap.put("'''", "<b>"); exchangeTokenMap.put("/'''","</b>"); //italic exchangeTokenMap.put("''", "<i>"); exchangeTokenMap.put("/''","</i>"); //sub heading exchangeTokenMap.put("===", "<h2>"); exchangeTokenMap.put("/===","</h2>"); //heading exchangeTokenMap.put("==", "<h1>"); exchangeTokenMap.put("/==","</h1>"); //non numbered lists exchangeTokenMap.put("**list", "<ul>"); exchangeTokenMap.put("/**list","</ul>"); exchangeTokenMap.put("*list", "<ul>"); exchangeTokenMap.put("/*list","</ul>"); exchangeTokenMap.put("**", "<li>"); exchangeTokenMap.put("/**","</li>"); exchangeTokenMap.put("*", "<li>"); exchangeTokenMap.put("/*","</li>"); //numbered lists exchangeTokenMap.put("##list", "<ol>"); exchangeTokenMap.put("/##list","</ol>"); exchangeTokenMap.put("#list", "<ol>"); exchangeTokenMap.put("/#list","</ol>"); exchangeTokenMap.put("##", "<li>"); exchangeTokenMap.put("/##","</li>"); exchangeTokenMap.put("#", "<li>"); exchangeTokenMap.put("/#","</li>"); //indent exchangeTokenMap.put("::list", "<dl>"); exchangeTokenMap.put("/::list","</dl>"); exchangeTokenMap.put(":list", "<dl>"); exchangeTokenMap.put("/:list","</dl>"); exchangeTokenMap.put("::", "<dd>"); exchangeTokenMap.put("/::","</dd>"); exchangeTokenMap.put(":", "<dd>"); exchangeTokenMap.put("/:","</dd>"); searchToken = searchTokenTmp; searchTokenWholeLine = searchTokenWholeLineTmp; } /** * Parse the given String. All wiki elements will be exchanged with * HTML tags. * @param toParse * @return The parsed String */ public static String parse(String toParse) { if (toParse == null) return null; String tmpParse = toParse; /* ATENTION: The Methods must be called in the right sequence!! * 1. initialize() * 2. deleteNowikiElements(String) * 3. parseSearchToken(tmpParse) * 4. parseSearchTokenWholeLine(tmpParse) * 5. parseImages(tmpParse) * 6. parseLinks(tmpParse) * 7. insertNowikiElements(tmpParse) * * */ //initialize the search tokens initialize(); /* delete the elementes, which should not be parsed -> the elements must * be inserted with the method insertNowikiElements(String) */ tmpParse = deleteNowikiElements(tmpParse); //parse the common elements tmpParse = parseSearchToken(tmpParse); //parse the elementes which affect the whole line tmpParse = parseSearchTokenWholeLine(tmpParse); //parse the images tmpParse = parseImages(tmpParse); //parse the links tmpParse = parseLinks(tmpParse); /* * Insert the elements, which should not be parsed -> this elements must * be deleted with the method deleteNowikiElements(String) */ tmpParse = insertNowikiElements(tmpParse); return tmpParse; } /** * Delete all comments in the content. * @param toParse To search through * @return The parsed content without all comments. */ public static String deleteComments(String toParse) { StringBuffer tmpToParse = new StringBuffer(toParse); int position = tmpToParse.indexOf(BEGINCOMMENT); int lastExtractPosition; while(position > -1) { lastExtractPosition = tmpToParse.indexOf(ENDCOMMENT, position+1); if(lastExtractPosition > -1) { lastExtractPosition += ENDCOMMENT.length(); } else { //if the comment is open -> search a end of line if(lastExtractPosition < 0) { lastExtractPosition = tmpToParse.indexOf(ENDOFLINE, position+1); } //if nothing is in the content -> use the end of file if(lastExtractPosition < 0) { lastExtractPosition = tmpToParse.length(); } } tmpToParse = tmpToParse.delete(position, lastExtractPosition); position = tmpToParse.indexOf(BEGINCOMMENT, position+1); } return tmpToParse.toString(); } /** * Replace the elements which are stored in the array 'searchToken', * with the adequate HTML tags. * @param toParse String to parse * @return The parsed String or null. */ private static String parseSearchToken(String toParse) { if(toParse == null || searchToken == null || exchangeTokenMap == null) return null; StringBuffer tmpStringBuffer = new StringBuffer(toParse); String tmpToken = null, tmpEndToken = null; int position = -1; int endPosition = -1; for(int i = 0; i < searchToken.length; i++) { tmpToken = searchToken[i]; tmpEndToken = "/"+tmpToken; //find first position of the token position = tmpStringBuffer.indexOf(tmpToken); while(position > -1) { //replace the begin token tmpStringBuffer = tmpStringBuffer.replace( position, position+tmpToken.length(), (String)exchangeTokenMap.get(tmpToken)); //replace the end token endPosition = tmpStringBuffer.indexOf(tmpToken, position); if(endPosition > -1) { tmpStringBuffer = tmpStringBuffer.replace( endPosition, endPosition+tmpToken.length(), (String)exchangeTokenMap.get(tmpEndToken)); } else { //If there is no endtoken endPosition = tmpStringBuffer.indexOf(ENDOFLINE, position); if(endPosition > -1) { tmpStringBuffer = tmpStringBuffer.replace( endPosition, endPosition+ENDOFLINE.length(), (String)exchangeTokenMap.get(tmpEndToken)); } else { tmpStringBuffer = tmpStringBuffer.insert( tmpStringBuffer.length(), (String)exchangeTokenMap.get(tmpEndToken)); } } //Look up for a other occurence position = tmpStringBuffer.indexOf(tmpToken, position+1); } } return tmpStringBuffer.toString(); } /** * Replace the elements which are stored in the array * 'searchTokenWholeLine', with the adequate HTML tags. * @param toParse String to parse. * @return The parsed String or null. */ private static String parseSearchTokenWholeLine(String toParse) { if (toParse == null || searchTokenWholeLine == null || exchangeTokenMap == null) return null; //StringBuffer to make the changes StringBuffer tmpToParse = new StringBuffer(toParse); //nested elements boolean openedElement = false; String tmpToken = null, tmpEndToken = null; int position = -1; //The string which will be inserted String insertToken; for(int i = 0; i < searchTokenWholeLine.length; i++) { openedElement = false; tmpToken = searchTokenWholeLine[i]; tmpEndToken = "/"+tmpToken; //first position is a special case position = tmpToParse.indexOf(tmpToken); if (position == 0) { //open a nested element openedElement = true; if(tmpToken.length() > 1) { insertToken = ""+exchangeTokenMap.get( tmpEndToken.substring(0,2))+ exchangeTokenMap.get(tmpToken+"list")+ exchangeTokenMap.get(tmpToken); } else { insertToken = (String)exchangeTokenMap.get(tmpToken+"list")+ exchangeTokenMap.get(tmpToken); } tmpToParse = tmpToParse.replace(0, position+tmpToken.length(), insertToken); /* replace the end token at the end of line and check if * the nested element must be closed */ if(hasNextLineElement(tmpToParse.toString(), position+1, tmpToken, ENDOFLINE)) { insertToken = exchangeTokenMap.get(tmpEndToken)+ENDOFLINE; } else { insertToken = (String)exchangeTokenMap.get(tmpEndToken)+ exchangeTokenMap.get(tmpEndToken+"list") + ENDOFLINE; openedElement = false; } tmpToParse = tmpToParse.replace( tmpToParse.indexOf(ENDOFLINE), tmpToParse.indexOf(ENDOFLINE)+ENDOFLINE.length(), insertToken); } position = tmpToParse.indexOf(ENDOFLINE+tmpToken); while (position > -1) { if(!openedElement) { openedElement = true; if(tmpToken.length() > 1) { insertToken = (String)exchangeTokenMap.get( tmpEndToken.substring(0,2))+ exchangeTokenMap.get(tmpToken+"list")+ exchangeTokenMap.get(tmpToken); } else { insertToken = (String)exchangeTokenMap.get( tmpToken+"list")+ exchangeTokenMap.get(tmpToken); } } else { //replace the begin token insertToken = (String)exchangeTokenMap.get(tmpToken); } tmpToParse = tmpToParse.replace( tmpToParse.indexOf(ENDOFLINE+tmpToken,position), tmpToParse.indexOf(ENDOFLINE+tmpToken,position)+ ENDOFLINE.length()+tmpToken.length(), insertToken); /* replace the end token at the end of line and check if * the nested element must be closed */ if(hasNextLineElement(tmpToParse.toString(), position+1, tmpToken, ENDOFLINE)) { //Test if token is already closed int tmpEndTokenIndex = tmpToParse.indexOf( (String)exchangeTokenMap.get(tmpEndToken+"list"), position+insertToken.length()); if((tmpEndTokenIndex > -1) && (tmpEndTokenIndex < tmpToParse.indexOf( ENDOFLINE,position+insertToken.length()))) { insertToken = ENDOFLINE; } else { insertToken = (String)exchangeTokenMap.get(tmpEndToken)+ ENDOFLINE; } } else { int tmpEndTokenIndex = tmpToParse.indexOf( (String)exchangeTokenMap.get(tmpEndToken+"list"), position+insertToken.length()); if((tmpEndTokenIndex > -1) && (tmpEndTokenIndex < tmpToParse.indexOf( ENDOFLINE,position+insertToken.length()))) { insertToken = exchangeTokenMap.get(tmpEndToken+"list") + ENDOFLINE; } else { insertToken = (String)exchangeTokenMap.get(tmpEndToken)+ exchangeTokenMap.get(tmpEndToken+"list") + ENDOFLINE; } openedElement = false; } //Check if at the end of toParse is a ENDOFLINE token if (tmpToParse.indexOf(ENDOFLINE,position+1) > -1) { tmpToParse = tmpToParse.replace( tmpToParse.indexOf(ENDOFLINE,position+1), tmpToParse.indexOf(ENDOFLINE,position+1)+ ENDOFLINE.length(), insertToken); } else { tmpToParse.insert(tmpToParse.length(), insertToken); } position = tmpToParse.indexOf(ENDOFLINE+tmpToken,position+1); } } return tmpToParse.toString(); } /** * Check if there is an other token of the same group of a line element. * It can be used to check, if the group should be closed. * A line element is in this case a token, which affect the whole line. * @param toScan Will be searched through. * @param beginPosition Start position of the search. * @param searchToken Token to be searched. It will be searched after a * endOfLine. * @param endOfLine The end of line token. * @return true if there is an other searchToken after a endOfLine, * otherwise false */ private static boolean hasNextLineElement(String toScan, int beginPosition, String searchToken, String endOfLine) { int posFirstSearchToken = toScan.indexOf(endOfLine+searchToken, beginPosition); if(posFirstSearchToken < 0) return false; /* It's not allowed that a end of line is between the first element * and a other element of the same type */ int posFirstEndOfLine = toScan.indexOf(endOfLine, beginPosition+1); if((posFirstEndOfLine < 0) || (posFirstEndOfLine >= posFirstSearchToken)) return true; return false; } /** * Delete all elements that should not be edited. The extracted elements * will be stored in the 'noWikiTextMap'. To insert the elments it must * be used the method insertNowikiElements(String). * @param toParse Will be searched through * @return The parsed variable toParse. If there are non 'No wiki elements' * it would not be changed. */ private static String deleteNowikiElements(String toParse) { if (toParse == null) return toParse; StringBuffer tmpToParse = new StringBuffer(toParse); //Counter that ensure the singleness of the inserted text into the Map int counter = 0; int position = tmpToParse.indexOf(BEGINNOWIKITEXT); int firstExtractPosition; int lastExtractPosition; String notEditedText = null; while(position > -1) { //The first position that will be extracted firstExtractPosition = position + BEGINNOWIKITEXT.length(); //The last position that will be extracted lastExtractPosition = tmpToParse.indexOf(ENDNOWIKITEXT, firstExtractPosition); //Substring that will be extracted notEditedText = tmpToParse.substring(firstExtractPosition, lastExtractPosition); //Insert the extracted String into the Map noWikiTextMap.put(""+counter, notEditedText); //Replace the text tmpToParse= tmpToParse.replace(firstExtractPosition, lastExtractPosition, ""+counter); counter++; position = toParse.indexOf(BEGINNOWIKITEXT, position+1); } return tmpToParse.toString(); } /** * Insert all elemts that should not be edited from the map 'noWikiTextMap'. * The elements which don't should be edited must be deleted with the * method deleteNowikiElements(String). * @param toParse Will be searched through * @return The parsed variable toParse. If there are non 'No wiki elements' * in the map, it would not be changed. */ private static String insertNowikiElements(String toParse) { if (toParse == null) return toParse; StringBuffer tmpToParse = new StringBuffer(toParse); int position = tmpToParse.indexOf(BEGINNOWIKITEXT); int firstExtractPosition; int lastExtractPosition; String parsedCounter = null; String insertElement = null; while(position > -1) { //The first position that will be extracted firstExtractPosition = (position + BEGINNOWIKITEXT.length()); //The last position that will be extracted lastExtractPosition = tmpToParse.indexOf(ENDNOWIKITEXT, firstExtractPosition); //Substring that will be extracted parsedCounter = tmpToParse.substring(firstExtractPosition, lastExtractPosition); //Insert the extracted String into the Map insertElement = (String)noWikiTextMap.get(parsedCounter); //Replace the text tmpToParse = tmpToParse.replace( position, lastExtractPosition+ENDNOWIKITEXT.length(), insertElement); position = tmpToParse.indexOf(BEGINNOWIKITEXT, position+1); } return tmpToParse.toString(); } /** * Insert the right link to the images. * @param toParse Will be parsed * @return Return toParse with the inserted link to the images. * If there are no images it will be changed nothing. */ private static String parseImages(String toParse) { if(toParse == null) return toParse; StringBuffer tmpToParse = new StringBuffer(toParse); int position = tmpToParse.indexOf(BEGINIMG); int firstExtractPosition; int lastExtractPosition; int separatorPosition; String parsedLink = null; String url = null; String description = null; while(position > -1) { firstExtractPosition = position+BEGINIMG.length(); lastExtractPosition = tmpToParse.indexOf(ENDIMG, position); parsedLink = tmpToParse.substring(firstExtractPosition, lastExtractPosition); //Change it to replace the tokens lastExtractPosition += ENDIMG.length(); //Check if the link has a description separatorPosition = parsedLink.indexOf(SEPARATORIMG); if(separatorPosition > -1) { url = parsedLink.substring(0, separatorPosition); description = parsedLink.substring(separatorPosition+1); tmpToParse = tmpToParse.replace( position, lastExtractPosition, "<img src=\"$portalRequest.getBaseUrl()/"+url+ "\" alt=\""+description+"\">"); } else { tmpToParse = tmpToParse.replace( position, lastExtractPosition, "<img src=\"$portalRequest.getBaseUrl()/"+parsedLink+ "\" alt=\""+parsedLink+"\">"); } position = tmpToParse.indexOf(BEGINIMG, position+1); } return tmpToParse.toString(); } /** * Insert the right links. * @param toParse Will be parsed * @return Return toParse with the inserted links. If there are no links * it will be changed nothing. */ private static String parseLinks(String toParse) { if(toParse == null) return toParse; StringBuffer tmpToParse = new StringBuffer(toParse); int position = tmpToParse.indexOf(BEGINLINK); int firstExtractPosition; int lastExtractPosition; int separatorPosition; String parsedLink = null; String url = null; String description = null; while(position > -1) { firstExtractPosition = position+BEGINLINK.length(); lastExtractPosition = tmpToParse.indexOf(ENDLINK, position); parsedLink = tmpToParse.substring(firstExtractPosition, lastExtractPosition); //Change it for inserting lastExtractPosition = lastExtractPosition+ENDLINK.length(); //Check if the link has a description separatorPosition = parsedLink.indexOf(SEPARATORLINK); if(separatorPosition > -1) { url = parsedLink.substring(0, separatorPosition); description = parsedLink.substring(separatorPosition+1); //Check if the URL is a external URL if(url.indexOf("www.") > -1) { tmpToParse = tmpToParse.replace( position, lastExtractPosition, "<a href=\""+url+"\">"+description+"</a>"); } else { if (url.indexOf(".") < 0) { url = url + "."+DEFAULTENDING; } else { url = "/"+url; } tmpToParse = tmpToParse.replace( position, lastExtractPosition, "<a href=\"$portalRequest.getBaseUrl()"+ url+"\">"+description+"</a>"); } } else { url = parsedLink; if(url.indexOf("www.") > -1) { tmpToParse = tmpToParse.replace( position, lastExtractPosition, "<a href=\""+url+"\">"+url+"</a>"); } else { if (url.indexOf(".") < 0) { url = url + "."+DEFAULTENDING; } else { url = "/"+url; } tmpToParse = tmpToParse.replace( position, lastExtractPosition, "<a href=\"$portalRequest.getBaseUrl()"+ url+"\">"+parsedLink+"</a>"); } } position = tmpToParse.indexOf(BEGINLINK,position+1); } return tmpToParse.toString(); } /** * Delete all elements which are in 'deleteToken'. * @param toParse Will be parsed. * @return Return toParse with the deleted elements. If there are no * elements to delete it will be changed nothing. */ public static String deleteToken(String toParse) { if(toParse == null || deleteToken == null) return toParse; StringBuffer tmpToParse = new StringBuffer(toParse); int position = -1; for(int i = 0; i < deleteToken.length; i++) { position = tmpToParse.indexOf(deleteToken[i]); while(position > -1) { tmpToParse = tmpToParse.delete(position, position+deleteToken[i].length()); position = tmpToParse.indexOf(deleteToken[i], position); } } return tmpToParse.toString(); } /** * Insert the link to the edit side with the right itemid. * @param itemid Itemid of the page which should be edited. * @param content Content where the link will be inserted. * @param position Position where the link will be inserted. * @return The content with the edit-link. */ public static String insertEditLink(int itemid, String content, int position) { if(content == null) return null; StringBuffer tmp = new StringBuffer(content); tmp.insert(position, replaceItemid(itemid)); return tmp.toString(); } /** * Search the place holder of the itemid and replace it with the real * itemid of the content. * @param itemid The itemid that will be inserted. * @return The edit-link with the right itemid. */ private static String replaceItemid(int itemid) { if(EDITLINK == null) return EDITLINK; StringBuffer tmp = new StringBuffer(EDITLINK); int pos = tmp.indexOf(ITEMID); if(pos > -1) { tmp = tmp.replace(pos, pos+ITEMID.length(), ""+itemid); } return tmp.toString(); } /** * Insert the history link into the content at the specific position. * @param itemid Itemid of the side which history should be shown. * @param lang Language of the side * @param content Content where the history list should be inserted * @param position Position where the link should be inserted * @return Content with the inserted history link. */ public static String insertHistoryLink(int itemid, String lang, String content, int position) { if(content == null) return null; StringBuffer tmp = new StringBuffer(content); tmp.insert(position, replaceItemidAndLanguage(itemid, lang)); return tmp.toString(); } /** * Search the place holder of the itemid and language in the history * and replace it with the real values. * @param itemid Itemid of the page. * @param lang Language of the page. * @return The history link with the right itemid and language. */ private static String replaceItemidAndLanguage(int itemid, String lang) { if(HISTORYLINK == null) return null; StringBuffer tmp = new StringBuffer(HISTORYLINK); int pos = tmp.indexOf(ITEMID); if(pos > -1) { tmp = tmp.replace(pos, pos+ITEMID.length(), ""+itemid); } pos = tmp.indexOf(LANG); if(pos > -1) { tmp = tmp.replace(pos, pos+LANG.length(), lang); } return tmp.toString(); } } |
|
From: Alexander G. <gaf...@us...> - 2006-01-16 09:23:31
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11954/src/org/cobricks/portal/wiki Log Message: Directory /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki added to the repository |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:39:39
|
Update of /cvsroot/cobricks/cobricks2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23070 Modified Files: changelog.txt build.properties.orig build.xml Log Message: Index: changelog.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/changelog.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- changelog.txt 13 Dec 2005 09:06:12 -0000 1.6 +++ changelog.txt 3 Jan 2006 09:39:31 -0000 1.7 @@ -1,6 +1,9 @@ Cobricks2 v0.36 - Support for Tomcat 5.5 added to development environment +- Changed default version of Apache Axis to 1.3 + +- Removed support for Liberty Alliance Single Sign On - New method resetCache() in Component interface - admin ui to reset the caches in all components @@ -10,8 +13,11 @@ own profile and items and categories - Adapted database schema to fit requirements of MySQL 5.0 and Oracle - (renamed some tables/attributes that conflict with new reserved terms) + (renamed some tables/attributes that conflict with reserved terms) +- Added support for searching items with itemclass is equal or derived + from a given itemclass + Cobricks2 v0.35 - core: org.cobricks.core.util.MailUtil now reads Cobricks properties Index: build.properties.orig =================================================================== RCS file: /cvsroot/cobricks/cobricks2/build.properties.orig,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- build.properties.orig 29 Nov 2005 07:21:04 -0000 1.6 +++ build.properties.orig 3 Jan 2006 09:39:31 -0000 1.7 @@ -2,7 +2,7 @@ catalina.home=/DIR/tomcat5.0.3 # for the version we currently support 5.0 and 5.5 catalina.version=5.0 -axis.home=/DIR/axis-1.1 +axis.home=/DIR/axis-1.3 catalina.serverport=8005 catalina.httpport=8080 catalina.httpsport=8443 Index: build.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/build.xml,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- build.xml 29 Nov 2005 07:22:34 -0000 1.51 +++ build.xml 3 Jan 2006 09:39:31 -0000 1.52 @@ -21,7 +21,7 @@ <property name="catalina.home" value="/usr/proj/java/jakarta-tomcat-5.0.28"/> <!-- we currently support tomcat version 5.0 and 5.5 --> <property name="catalina.version" value="5.0"/> -<property name="axis.home" value="/usr/proj/java/axis-1.2"/> +<property name="axis.home" value="/usr/proj/java/axis-1.3"/> <property name="dist.home" value="${basedir}/dist"/> <property name="distbin" value="${basedir}/dist/cobricks2-v0.36"/> <property name="distsrc" value="${basedir}/dist/cobricks2-v0.36-src"/> |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:37:49
|
Update of /cvsroot/cobricks/cobricks2/web/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22820/WEB-INF Modified Files: web.xml Log Message: Index: web.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/WEB-INF/web.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- web.xml 18 Mar 2005 14:18:19 -0000 1.10 +++ web.xml 3 Jan 2006 09:37:39 -0000 1.11 @@ -304,138 +304,5 @@ </filter-mapping> - -<!-- Servlet mit Tagets fuer SSO, wird von Velocity-Templatey adressiert --> - - <servlet> - <servlet-name>LibertyServlet</servlet-name> - <servlet-class>org.cobricks.user.liberty.idff.LibertyServlet</servlet-class> - </servlet> - - <servlet-mapping> - <servlet-name>LibertyServlet</servlet-name> - <url-pattern>/user/LibertyServlet</url-pattern> - </servlet-mapping> - - -<!-- Servlets von SourceID --> - -<!-- Servlet Declarations. Mapping to client-accessible URL's comes later. --> - -<!-- SourceID-SSO Manager Servlet (configuration is loaded here) --> - <servlet> - <servlet-name>SourceID-SSO-Manager</servlet-name> - <description>Loads configuration at boot time, and provides instrumentation and admin - control</description> - <servlet-class>org.sourceid.sso.servlets.Manager</servlet-class> - <load-on-startup>1</load-on-startup> - </servlet> - -<!-- SourceID-SSO Authenticator Servlet --> - <servlet> - <servlet-name>SourceID-SSO-Authenticator</servlet-name> - <description>Provides Identity Provider (IDP) Authentication Services</description> - <servlet-class>org.sourceid.sso.servlets.Authenticator</servlet-class> - </servlet> - -<!-- SourceID-SSO AuthnRequestor Servlet --> - <servlet> - <servlet-name>SourceID-SSO-AuthnRequestor</servlet-name> - <description>Provides Service Provider (SP) Authentication Request Services</description> - <servlet-class>org.sourceid.sso.servlets.AuthnRequestor</servlet-class> - </servlet> - -<!-- SourceID-SSO Federation Terminator Servlet --> - <servlet> - <servlet-name>SourceID-SSO-FederationTerminator</servlet-name> - <description>Provides Federation Termination Services</description> - <servlet-class>org.sourceid.sso.servlets.FederationTerminator</servlet-class> - </servlet> - -<!-- SourceID-SSO Federation Terminator Servlet --> - <servlet> - <servlet-name>SourceID-SSO-Logout</servlet-name> - <description>Provides Single Logout Services</description> - <servlet-class>org.sourceid.sso.servlets.Logout</servlet-class> - </servlet> - -<!-- SourceID-SSO Federation Terminator Servlet --> - <servlet> - <servlet-name>SourceID-SSO-NameRegistrar</servlet-name> - <description>Provides Single Logout Services</description> - <servlet-class>org.sourceid.sso.servlets.NameRegistrar</servlet-class> - </servlet> - -<!-- SourceID-SSO Identity Provider Introduction Reader Servlet --> - <servlet> - <servlet-name>SourceID-SSO-IDPIntroductionReader</servlet-name> - <description>Provides Identity Provider Introduction Services (Cookie Reader)</description> - <servlet-class>org.sourceid.sso.servlets.IDPIntroductionReader</servlet-class> - </servlet> - -<!-- SourceID-SSO Identity Provider Introduction Writer Servlet --> - <servlet> - <servlet-name>SourceID-SSO-IDPIntroductionWriter</servlet-name> - <description>Provides Identity Provider Introduction Services (Cookie Writer)</description> - <servlet-class>org.sourceid.sso.servlets.IDPIntroductionWriter</servlet-class> - </servlet> - -<!-- SourceID-SSO SOAP Endpoint Servlet --> - <servlet> - <servlet-name>SourceID-SSO-SOAPEndpoint</servlet-name> - <description>SOAP Endpoint</description> - <servlet-class>org.sourceid.sso.servlets.SOAPEndpoint</servlet-class> - </servlet> - -<!-- Servlet Mappings to client-accessible URL's --> - -<!-- Authenticator Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-Authenticator</servlet-name> - <url-pattern>/sso/authn</url-pattern> - </servlet-mapping> - -<!-- AuthnRequestor Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-AuthnRequestor</servlet-name> - <url-pattern>/sso/authnRequest</url-pattern> - </servlet-mapping> - -<!-- FederationTerminator Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-FederationTerminator</servlet-name> - <url-pattern>/sso/fedterm</url-pattern> - </servlet-mapping> - -<!-- Logout Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-Logout</servlet-name> - <url-pattern>/sso/logout</url-pattern> - </servlet-mapping> - -<!-- NameRegistrar Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-NameRegistrar</servlet-name> - <url-pattern>/sso/rni</url-pattern> - </servlet-mapping> - -<!-- IDPIntroductionReader Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-IDPIntroductionReader</servlet-name> - <url-pattern>/sso/idpiReader</url-pattern> - </servlet-mapping> - -<!-- IDPIntroductionWriter Servlet --> - <servlet-mapping> - <servlet-name>SourceID-SSO-IDPIntroductionWriter</servlet-name> - <url-pattern>/sso/idpiWriter</url-pattern> - </servlet-mapping> - -<!-- SOAP Handler --> - <servlet-mapping> - <servlet-name>SourceID-SSO-SOAPEndpoint</servlet-name> - <url-pattern>/sso/soap/*</url-pattern> - </servlet-mapping> - </web-app> |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:37:49
|
Update of /cvsroot/cobricks/cobricks2/web/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22820/item Modified Files: index.html.en itemlist.html.en itemsearch.html.en Log Message: Index: itemlist.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/item/itemlist.html.en,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- itemlist.html.en 10 Aug 2005 12:57:41 -0000 1.1 +++ itemlist.html.en 3 Jan 2006 09:37:39 -0000 1.2 @@ -21,8 +21,15 @@ <p> <ul> #foreach ($i in $itemManager.searchItems($itemPresenter.constructSearchXPath($portalRequest))) -<li>$!i.getId(): $!i.getTitle() - -<a href="itemupdate.html?itemid=$i.getId()">edit</a>, <a href="/ITEM?cmd=deleteitem&cmd.success=/item/itemlist.html&cmd.error=/item/itemlist.html&itemid=$i.getId()&itemclass=$!itemclass">delete</a> +<li>$!i.getId(): $!i.getTitle() +#set ( $accedit = $userPresenter.checkPermission($userId, "item", "update", $i) ) +#set ( $accdel = $userPresenter.checkPermission($userId, "item", "delete", $i) ) +#if ( "$!accedit" == "true" ) +- <a href="itemupdate.html?itemid=$i.getId()">edit</a> +#end +#if ( "$!accdel" == "true" ) +- <a href="/ITEM?cmd=deleteitem&cmd.success=/item/itemlist.html&cmd.error=/item/itemlist.html&itemid=$i.getId()&itemclass=$!itemclass">delete</a> +#end #end </ul> Index: itemsearch.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/item/itemsearch.html.en,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- itemsearch.html.en 10 Aug 2005 12:57:41 -0000 1.1 +++ itemsearch.html.en 3 Jan 2006 09:37:39 -0000 1.2 @@ -26,8 +26,17 @@ #if ($title) <li><a href="item.html?itemid=$item.getId()&fromSearch=true">$title</a></li> #else - <li><a href="item.html?itemid=$item.getId()&fromSearch=true">No title specified for this item</a></li> + <li><a href="item.html?itemid=$item.getId()&fromSearch=true">No title specified for this item</a> #end +#set ( $accedit = $userPresenter.checkPermission($userId, "item", "update", $i) ) +#set ( $accdel = $userPresenter.checkPermission($userId, "item", "delete", $i) ) +#if ( "$!accedit" == "true" ) +- <a href="itemupdate.html?itemid=$i.getId()">edit</a> +#end +#if ( "$!accdel" == "true" ) +- <a href="/ITEM?cmd=deleteitem&cmd.success=/item/itemlist.html&cmd.error=/item/itemlist.html&itemid=$i.getId()&itemclass=$!itemclass">delete</a> +#end + </li> #end </ul> #end Index: index.html.en =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/item/index.html.en,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- index.html.en 13 Dec 2005 09:05:54 -0000 1.12 +++ index.html.en 3 Jan 2006 09:37:39 -0000 1.13 @@ -30,7 +30,7 @@ <li><a href="itemlist.html?itemclass=msg">Item list - itemclass=msg</a></li> <li><a href="itemlist.html?itemclass=date">Item list - itemclass=date</a></li> <li><a href="itemlist.html?itemclass=portalpagehtml">Item list - itemclass=portalpagehtml</a></li> -<li><a href="itemsearch.html">Search for an item</a></li> +<li><a href="itemsearch.html">Search for items</a></li> </ul> |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:37:48
|
Update of /cvsroot/cobricks/cobricks2/web/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22820/user Modified Files: role-editperm2.html Log Message: Index: role-editperm2.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/user/role-editperm2.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- role-editperm2.html 11 Feb 2004 14:36:28 -0000 1.1 +++ role-editperm2.html 3 Jan 2006 09:37:39 -0000 1.2 @@ -63,7 +63,15 @@ #foreach( $i in $userManager.getAccessControl().getAccessHandler($permdomain).getDomainActionAttributes($permaction) ) <option value="$i">$i #end -</select> <input name="permavalue5" size="30"><br> +</select> <input name="permavalue5" size="30"><p> + +The attribute names provided for restricting the permission are a +subset of the attributes defined in the basic ontology for the +domain. The subset is specified in the AccessHandler component for the +given domain. +<p> +Values can either be string or integer values. Additionally, you can +use the keywords "ownuserid", "ownuserlogin" and "ownuserclass". <p> <input type="submit" value="Add Permission"/> |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:37:09
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/course In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22649/course Modified Files: CourseManagerImpl.java Log Message: Index: CourseManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManagerImpl.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- CourseManagerImpl.java 20 Dec 2005 18:09:59 -0000 1.53 +++ CourseManagerImpl.java 3 Jan 2006 09:36:56 -0000 1.54 @@ -136,18 +136,46 @@ if (res == -1) dbAccess.createTable(tablename); else if (res == -2) { logger.info("Found need to update table "+tablename); - if (tablename.equals("course_lecturer")) { + if (tablename.equals("course")) { + // non-versioned schema change Dec 2005: + // this should be removed soon ... + try { + if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_MYSQL) { + String sql = "ALTER TABLE course CHANGE `ctplid` cmid int"; + dbAccess.sqlExecute(sql, true); + } + if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_POSTGRES) { + String sql = "ALTER TABLE course RENAME COLUMN ctplid TO cmid"; + dbAccess.sqlExecute(sql, true); + } + } catch (Exception e) { } + } + else if (tablename.equals("course_progrel")) { + // non-versioned schema change Dec 2005: + // this should be removed soon ... + try { + if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_MYSQL) { + String sql = "ALTER TABLE course_progrel CHANGE `ctplid` cmid int"; + dbAccess.sqlExecute(sql, true); + } + if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_POSTGRES) { + String sql = "ALTER TABLE course_progrel RENAME COLUMN ctplid TO cmid"; + dbAccess.sqlExecute(sql, true); + } + } catch (Exception e) { } + } + else if (tablename.equals("course_lecturer")) { // non-versioned schema change Dec 2005: // this should be removed soon ... // renamed columns size, url, creatoriontime try { if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_MYSQL) { String sql = "ALTER TABLE course_lecturer CHANGE `uid` globalid varchar(64)"; - dbAccess.sqlExecute(sql); + dbAccess.sqlExecute(sql, true); } if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_POSTGRES) { String sql = "ALTER TABLE course_lecturer RENAME COLUMN uid TO globalid"; - dbAccess.sqlExecute(sql); + dbAccess.sqlExecute(sql, true); } } catch (Exception e) { } } else |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:36:27
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22566 Modified Files: PortalManagerImpl.java Log Message: Support for sub classes of portalpagehtml itemclass Index: PortalManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalManagerImpl.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- PortalManagerImpl.java 7 Dec 2005 14:00:50 -0000 1.68 +++ PortalManagerImpl.java 3 Jan 2006 09:36:18 -0000 1.69 @@ -466,8 +466,8 @@ // and now look for a portalpage item that has the portalfolder // category assigned - String xpath = "/item[itemclass='portalpagehtml' and " - +"name='"+pageName+"'] and " + String xpath = "/item[itemclass~'portalpagehtml'] and " + +"/item[name='"+pageName+"'] and " +"/item/folders/category/id="+Integer.toString(c.getId()); List p = itemManager.searchItems(xpath); if (p != null && p.size()>0) { @@ -520,8 +520,8 @@ throw new CobricksException("portal", "nopath", ""); // check if the page already exits - String xpath = "/item[itemclass='portalpagehtml' and " - +"name='"+pageName+"'] and " + String xpath = "/item[itemclass~'portalpagehtml'] and " + +"/item[name='"+pageName+"'] and " +"/item/folders/category/id="+Integer.toString(c.getId()); List items = itemManager.searchItems(xpath); if (items != null && items.size()>0) @@ -692,8 +692,8 @@ throws CobricksException { // search for page items in this folder - String xpath_query = "/item[itemclass='portalpagehtml' and " - + " folders/category/id="+cid + "]"; + String xpath_query = "/item[itemclass~'portalpagehtml'] and " + + "/item[folders/category/id="+cid + "]"; List pages = itemManager.searchItems(xpath_query); for (int i = 0; i < pages.size(); i++) { PortalPage p = (PortalPage) pages.get(i); @@ -1131,16 +1131,16 @@ public List getPagesWithPageCategory(int pagecategory_id) { String xpathQuery = - "/item[itemclass=\"portalpagehtml\" " - +"and pagecategories/category/id=" + pagecategory_id + "]"; + "/item[itemclass~\"portalpagehtml\"] " + +"and /item[pagecategories/category/id=" + pagecategory_id + "]"; return itemManager.searchItems(xpathQuery); } public List getPagesWithPortalCategory(int portalcategory_id) { String xpathQuery = - "/item[itemclass=\"portalpagehtml\" " - +"and portalcategory/id=" + portalcategory_id + "]"; + "/item[itemclass~\"portalpagehtml\"] " + +"and /item[portalcategory/id=" + portalcategory_id + "]"; return itemManager.searchItems(xpathQuery); } @@ -1155,13 +1155,13 @@ searchWord = searchWord.toLowerCase(); String query = ""; if (searchInTitle == true) { - query = "/item[itemclass='portalpagehtml' and (" + + query = "/item[itemclass~'portalpagehtml'] and /item[(" + "contains(translate(content, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') or " + "contains(translate(navtitle, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') or " + "contains(translate(title, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "')" + ")]"; } else { - query = "/item[itemclass='portalpagehtml' and (" + + query = "/item[itemclass~'portalpagehtml'] and /item[(" + "contains(translate(content, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') )]"; } |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:35:28
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22419/db Modified Files: DBAccess.java DBAccessImpl.java Log Message: Support for searching child classes Index: DBAccessImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccessImpl.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- DBAccessImpl.java 20 Dec 2005 18:10:24 -0000 1.24 +++ DBAccessImpl.java 3 Jan 2006 09:35:20 -0000 1.25 @@ -1175,10 +1175,16 @@ } + public void sqlExecute(String sql) + { + sqlExecute(sql, false); + } + /** * Execute the given SQL statement. + * @param donotlogerrors if true, then exceptions will not be logged */ - public void sqlExecute(String sql) + public void sqlExecute(String sql, boolean donotlogerrors) { if (sql==null || sql.trim().length()<1) return; logger.debug("sqlExecute("+sql+")"); @@ -1190,7 +1196,11 @@ if (dbtype == DBTYPE_ORACLE) stmt.setEscapeProcessing(false); stmt.executeUpdate(sql); } catch(Exception e) { - logger.error(LogUtil.ex("Failed executing sql statement: "+sql, e)); + if (donotlogerrors) + logger.error("Failed executing sql statement"); + else + logger.error(LogUtil.ex("Failed executing sql statement: " + +sql, e)); } finally { try { stmt.close(); } catch (Exception e) { } try { conn.close(); } catch (Exception e) { } Index: DBAccess.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccess.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- DBAccess.java 21 Oct 2005 15:56:46 -0000 1.9 +++ DBAccess.java 3 Jan 2006 09:35:20 -0000 1.10 @@ -68,6 +68,7 @@ public Map sqlQuerySingleRow(String sql); public void sqlExecute(String sql); + public void sqlExecute(String sql, boolean donotlogerrors); // create a new value for the primary key column of the given table public String getNewPrimaryKey(String tablename, String primarykeycol); |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:35:28
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22419 Modified Files: Ontology.java OntologyClass.java Log Message: Support for searching child classes Index: Ontology.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/Ontology.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Ontology.java 10 Aug 2005 13:31:33 -0000 1.5 +++ Ontology.java 3 Jan 2006 09:35:20 -0000 1.6 @@ -19,7 +19,7 @@ import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; -import org.apache.log4j.*; +import org.apache.log4j.Logger; import org.w3c.dom.*; import org.xml.sax.*; @@ -92,6 +92,26 @@ /** + * Return the OntologyClass objects of all children classes of + * the given class + * @param recursive if true, then also grand children etc will be + * returned + */ + public Set getChildren(OntologyClass parent, boolean recursive) + { + Set result = new HashSet(); + if (parent == null) return result; + Iterator i = classes.values().iterator(); + while (i.hasNext()) { + OntologyClass oc = (OntologyClass)i.next(); + if (oc.getParent() == parent) + result.add(oc); + } + return result; + } + + + /** * Read the ontology definition from the given file. * * @param file The file to load Index: OntologyClass.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/OntologyClass.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- OntologyClass.java 22 Aug 2005 13:52:06 -0000 1.7 +++ OntologyClass.java 3 Jan 2006 09:35:20 -0000 1.8 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Cobricks Group. All rights reserved. + * Copyright (c) 2003-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 |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:33:43
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22020 Modified Files: ItemAttachment.java ItemManagerImpl.java ItemSearch.java Log Message: Added support for searching itemclass in subclasses Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- ItemManagerImpl.java 20 Dec 2005 18:08:52 -0000 1.60 +++ ItemManagerImpl.java 3 Jan 2006 09:33:34 -0000 1.61 @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.List; import java.util.Properties; +import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -229,10 +230,11 @@ } if (dbAccess.getDBType()==DBAccessImpl.DBTYPE_POSTGRES) { String sql = "ALTER TABLE item_attachment RENAME COLUMN url TO aurl"; - dbAccess.sqlExecute(sql); + dbAccess.sqlExecute(sql, true); sql = "ALTER TABLE item_attachment RENAME COLUMN size TO asize"; - dbAccess.sqlExecute(sql); + dbAccess.sqlExecute(sql, true); sql = "ALTER TABLE item_attachment RENAME COLUMN creatoriontime TO creationtime"; + dbAccess.sqlExecute(sql, true); } } catch (Exception e) { } } else @@ -733,7 +735,35 @@ String result = null; Set resultSet = null; List list = null; - Item item = null; + Item item = null; + + // !!! currently we just support "/item[itemclass~'x']" + // repace "itemclass~'x'" into (itemclass='x' or itemclass='y') + // for all itemclasses y, that are derived from x + int pos = query.indexOf("/item[itemclass~"); + while (pos >= 0) { + String tmps = query.substring(pos+17); + int pos2 = tmps.indexOf("]"); + if (pos2 > 0) { + tmps = tmps.substring(0, pos2-1); + } + Set childrenclassnames = ontology. + getChildren(ontology.getClass(tmps), true); + StringBuffer sb = + new StringBuffer("/item[itemclass='"+tmps+"'"); + Iterator i = childrenclassnames.iterator(); + while (i.hasNext()) { + OntologyClass oc = (OntologyClass)i.next(); + String tmps2 = oc.getName(); + sb.append(" OR itemclass='"+tmps2+"'"); + } + sb.append("]"); + query = query.substring(0, pos) + sb.toString() + + query.substring(pos + pos2 + 18); + pos = query.indexOf("/item[itemclass~"); + } + + // get item ids resultSet = ItemSearch.getIDsFromSQLQuery(query, this.ontology, this.dbAccess); if (resultSet != null) { Index: ItemSearch.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemSearch.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- ItemSearch.java 13 Dec 2005 09:05:03 -0000 1.23 +++ ItemSearch.java 3 Jan 2006 09:33:34 -0000 1.24 @@ -1626,7 +1626,6 @@ return null; } } - sqlStrucsVec.add(exprLP.getSqlStruc()); } } Index: ItemAttachment.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemAttachment.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ItemAttachment.java 13 Dec 2005 09:05:02 -0000 1.7 +++ ItemAttachment.java 3 Jan 2006 09:33:34 -0000 1.8 @@ -151,7 +151,12 @@ o = attrs.get("creatorid"); if (o != null) this.creatorid = ((Integer)o).intValue(); - this.creationtime = (Date)attrs.get("creationtime"); + o = attrs.get("creationtime"); + if (o instanceof Date) + this.creationtime = (Date)o; + else + this.creationtime = null; + // TBD: else parse creationtime this.title = (String)attrs.get("name"); this.comment = (String)attrs.get("comment"); this.mimetype = (String)attrs.get("mimetype"); |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:33:43
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item/sqlsearch/exprparts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22020/sqlsearch/exprparts Modified Files: Comparison.java ComparisonOperator.java Log Message: Added support for searching itemclass in subclasses Index: ComparisonOperator.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/sqlsearch/exprparts/ComparisonOperator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ComparisonOperator.java 18 Feb 2005 20:54:55 -0000 1.1 +++ ComparisonOperator.java 3 Jan 2006 09:33:34 -0000 1.2 @@ -12,6 +12,7 @@ public final static int NOTDEFINED = -2; public final static int EXISTENCE = -1; //define value "-1" as 'no operator' public final static int EQUAL = 0; + public final static int IN = 10; public final static int NOTEQUAL = 1; public final static int LESS = 2; public final static int GREATER = 3; Index: Comparison.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/sqlsearch/exprparts/Comparison.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Comparison.java 28 Mar 2005 15:47:30 -0000 1.2 +++ Comparison.java 3 Jan 2006 09:33:34 -0000 1.3 @@ -1,5 +1,8 @@ package org.cobricks.item.sqlsearch.exprparts; +import java.util.Iterator; +import java.util.Set; + /** * Represents expressions of type comparison contained in search path string * like: @@ -15,6 +18,7 @@ private String path = null; private int compOp = ComparisonOperator.NOTDEFINED; private Value value = null; + private Set valueset = null; /** * @@ -38,6 +42,24 @@ } } + /* + public Comparison(String path, int compOp, Set valueset, String pathType) { + this.path = path; + this.compOp = compOp; + this.value = null; + this.valueset = valueset; + if (valueset != null) { + Iterator i = valueset.iterator(); + this.value = (Value)i.next(); + } + this.setLocationPathType(pathType); + + if ((value != null) && (value.getParent() != null)) { + value.setParent(this); + } + } + */ + public String getPath() { return path; } |
|
From: Michael K. <ko...@us...> - 2006-01-03 09:32:40
|
Update of /cvsroot/cobricks/cobricks2/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21878 Modified Files: pageheader.html Log Message: Removed support for Liberty Alliance Single Sign On Index: pageheader.html =================================================================== RCS file: /cvsroot/cobricks/cobricks2/web/pageheader.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pageheader.html 1 Jun 2005 16:37:49 -0000 1.14 +++ pageheader.html 3 Jan 2006 09:32:32 -0000 1.15 @@ -122,128 +122,6 @@ </span> </div></div> -<p> </p> - - -<!--Single Sign-On begin--> - -#set ($libertyBridge=$userManager.getLAIdffBridge()) -#set ($role=$libertyBridge.getRole($portalRequest)) - -#if ("$!userLogin" == "anonymous" && "$!role" == "sp") - -<div class="box"> -<div class="header"> - <div class="title"> - Single Sign-On - </div> -</div> -<div class="body2"> - <div class="content last"> - <span class="boxNavHeadline"> - <div> - This Cobricks-2 installation acts as an Serviceprovider <br><br> - Choose an Liberty Alliance identity provider:<br><br> - -#set ($idpList = $libertyBridge.getIdps($portalRequest)) - -#if (($idpList)) - #foreach ($i in $idpList) - <a href="/user/LibertyServlet?cmd=auth&providerID=$i.getName()">$i.getName()</a><br> - #end -#end - - </div> - </span> - </div> -</div> - -#else - -#if($!userLogin != "anonymous") - -##wenn durch Identitätsprovider angemeldet und die Bestätigung -##abgelaufen ist, Benutzer abmelden -#if("$!role" == "sp") -#set($curIdp=$libertyBridge.getCurrentIDP($portalRequest)) - #if($curIdp) - #set($date=$curIdp.getReauthenticateOnOrAfter()) - #if($date) - #if($libertyBridge.checkExpiration($date)) - ##Bestätigung ist abgelaufen, auf PortalServlet weiterleiten um Logout zu machen - ##Hier könnte man eine Seite als Parameter für den Aufruf von /PORTAL?cmd=logout - ##über den Parameter cmd.sussess übergeben die dem User eine Meldung ausgibt. - ##Funktioniert aber bei diesem cmd nicht. Dann würde aber auch eine - ##Endlosschleife auftreten die man durch ein Flag umgehen müsste, z.B so - ##set($returnPage="/user/la/expired.html?flag=1") - ##set($adress="/PORTAL?cmd=logout&cmd.success=$returnPage") - ##flag prüfen, sonst Endlosschleife - ##set($flag=$request.getParameter("flag")) - ##if(!$flag) - ##forward auf PortalServlet - ##end - #set($adress="/PORTAL?cmd=logout") - #set($request=$portalRequest.getHttpServletRequest()) - #set($response=$portalRequest.getHttpServletResponse()) - $request.getRequestDispatcher($adress).forward($request, $response) - #end - #end - #end -#end - -<div class="box"> -<div class="header"> -<div class="title"> - Single Sign-On -</div> -</div> -<div class="body2"> - <div class="content last"> - <span class="boxNavHeadline"> - <div> -#if("$!role" == "sp") - This Cobricks-2 installation acts as an Serviceprovider <br><br> -#set($currentIDP = $libertyBridge.getCurrentIDP($portalRequest)) -#set($currentIDPName = $currentIDP.getName()) -#if($currentIDPName) - You are logged in through Liberty Alliance identity provider <b>"$currentIDPName"</b><br><br> - #set($ex=$currentIDP.getReauthenticateOnOrAfter()) - #if($ex) - This session will expire at<br> - $ex<br><br> - #end - Click - <a href="/user/LibertyServlet?cmd=logout&providerID=$currentIDPName&userID=$!userLogin"> - here - </a> - to make a global logout (this session and all session at third party serviceproviders made through $currentIDPName) -#else - You are logged in local -#end -<br><br> -Click -<a href="/user/la/managefederationssp.html"> - here -</a> - to manage your federated identities -#else - This Cobricks-2 installation acts as an Liberty Alliance identity provider <br><br> - Click - <a href="/user/la/managefederationsidp.html"> - here - </a> - to manage your federated identities -#end - </div> - </span> - </div> -</div> -#end -#end - -<!--Single Sign-On end--> - - </td></tr> </table> </td></tr> |
|
From: Michael K. <ko...@us...> - 2005-12-20 18:10:33
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23729/cobricks/user Modified Files: AccessPermission.java User.java UserAccessHandler.java UserManagerImpl.java UserPresenter.java UserroleAccessHandler.java Log Message: Index: UserPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserPresenter.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- UserPresenter.java 21 Oct 2005 15:56:46 -0000 1.29 +++ UserPresenter.java 20 Dec 2005 18:10:24 -0000 1.30 @@ -21,6 +21,7 @@ import org.cobricks.core.CobricksException; import org.cobricks.core.ComponentDirectory; import org.cobricks.core.CoreManager; +import org.cobricks.core.DataObject; import org.cobricks.core.Ontology; import org.cobricks.core.OntologyClass; import org.cobricks.core.OntologyClassAttr; @@ -129,6 +130,28 @@ /** + * + */ + public String checkPermission(String userid, String domain, + String action, DataObject o) + { + logger.info("checkPermission(" + userid + "," + domain + "," + action + + "," + o.toString() + ")"); + + try { + int useridint = Integer.parseInt(userid); + Map attrsmap = o.getAttributes(); + return (userManager.checkPermission(useridint, domain, action, + attrsmap) ? "true" + : "false"); + } catch (Exception e) { + logger.error(LogUtil.exception("Failed parsing parameters.", e)); + } + return "false"; + } + + + /** * Check if a user has a particular role - the role can either be specified * by its roleid (an Integer) or by its name. */ Index: AccessPermission.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/AccessPermission.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AccessPermission.java 4 Nov 2004 17:36:05 -0000 1.3 +++ AccessPermission.java 20 Dec 2005 18:10:24 -0000 1.4 @@ -1,14 +1,10 @@ -/** - * - * @author mic...@ac... - * @version $Date$ - * - * Copyright (c) 2003 Cobricks Group. All rights reserved. +/* + * 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.de). + * 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. @@ -16,10 +12,16 @@ package org.cobricks.user; -import java.util.*; +import java.util.Iterator; +import java.util.Map; -import org.apache.log4j.*; +import org.apache.log4j.Logger; +/** + * + * @author mic...@ac... + * @version $Date$ + */ public class AccessPermission implements Comparable @@ -134,21 +136,38 @@ return domain.compareTo(((AccessPermission)o).getDomain()); } - public boolean contains(String dom, String ac, Map att) + public boolean contains(User user, String dom, String ac, Map objattrs) { + // wrong domain if (!this.domain.equals(dom)) return false; + // wrong action if (!(this.action.equals(ac) || this.action.equals("*"))) return false; - // tbd: compare attributes ... or should this be done in the access handlers? + // domain and action match - now we have to compare the + // restricting attributes ... + + // ... the simplest case is if there are no restricting attributes if (attrs == null) return true; + Iterator i = attrs.keySet().iterator(); while (i.hasNext()) { String aname = (String)i.next(); String avalue = (String)attrs.get(aname); + // handle special keywords + if (avalue.equalsIgnoreCase("ownuserid")) + avalue = Integer.toString(user.getUserId()); + if (avalue.equalsIgnoreCase("ownuserclass")) + avalue = user.getUserClass(); + if (avalue.equalsIgnoreCase("ownuserlogin")) + avalue = user.getUserLogin(); + // check attribute - String avalueaccess = (String)att.get(aname); - if (avalueaccess != null) { + Object o = objattrs.get(aname); + if (o != null) { + String avalueaccess = (String)o.toString(); + // TBD compare sets, wildcards + if (!avalueaccess.equalsIgnoreCase(avalue)) return false; } } Index: UserroleAccessHandler.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserroleAccessHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- UserroleAccessHandler.java 26 Oct 2004 00:46:35 -0000 1.3 +++ UserroleAccessHandler.java 20 Dec 2005 18:10:24 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004 Cobricks Group. All rights reserved. + * 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; @@ -119,12 +119,13 @@ // get permissions of user AccessControl ac = userManager.getAccessControl(); List permissions = ac.getAccessPermissionsByUser(userid); + User user = userManager.getUser(userid); Iterator i = permissions.iterator(); while (i.hasNext()) { AccessPermission perm = (AccessPermission)i.next(); // check if this is the requested permission - if (perm.contains(domain, action, attrs)) return true; + if (perm.contains(user, domain, action, attrs)) return true; } return false; Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- UserManagerImpl.java 7 Dec 2005 14:01:46 -0000 1.53 +++ UserManagerImpl.java 20 Dec 2005 18:10:24 -0000 1.54 @@ -1301,11 +1301,11 @@ createAccessRole("user", "Default user", AccessRole.ROLETYPE_AUTH, u); Map myattrs = new HashMap(); - myattrs.put("userid", "own"); + myattrs.put("userid", "ownuserid"); accessControl. addAccessPermission(roleid, "user", "*", myattrs); myattrs = new HashMap(); - myattrs.put("creator", "own"); + myattrs.put("creator", "ownuserid"); accessControl. addAccessPermission(roleid, "item", "create", null); accessControl. Index: User.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/User.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- User.java 18 Oct 2005 23:54:19 -0000 1.27 +++ User.java 20 Dec 2005 18:10:24 -0000 1.28 @@ -36,8 +36,10 @@ static Logger logger = Logger.getLogger(User.class); - public static final String PASSWORDCRYPT = "basic.credentials.password.crypt"; - public final static String PASSWORDBASE64 = "basic.credentials.password.base64"; + public static final String PASSWORDCRYPT = + "basic.credentials.password.crypt"; + public final static String PASSWORDBASE64 = + "basic.credentials.password.base64"; public static final String LASTLOGIN = "history.org.cobricks.lastlogin"; public static final String FIRSTNAME = "basic.personal.firstname"; @@ -45,10 +47,12 @@ public static final String USERCLASS = "userclass"; public static final String EMAIL = "basic.contact-work.online.email"; - public static final String EMAILBOUNCED = "basic.contact-work.online.emailbounced"; + public static final String EMAILBOUNCED = + "basic.contact-work.online.emailbounced"; public static final String URI = "basic.contact-work.online.uri"; public static final String IMAGEURI = "basic.personal.imageuri"; - public static final String TELECOMMOBILE = "basic.contact-work.telecom.mobile"; + public static final String TELECOMMOBILE = + "basic.contact-work.telecom.mobile"; public static final String REGTIME = "history.org.cobricks.regtime"; public static final String USERLOGIN = "userlogin"; public static final String GLOBALID = "globalid"; Index: UserAccessHandler.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserAccessHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- UserAccessHandler.java 26 Oct 2004 00:46:35 -0000 1.3 +++ UserAccessHandler.java 20 Dec 2005 18:10:24 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004 Cobricks Group. All rights reserved. + * 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; @@ -115,12 +115,13 @@ // get permissions of user AccessControl ac = userManager.getAccessControl(); List permissions = ac.getAccessPermissionsByUser(userid); + User user = userManager.getUser(userid); Iterator i = permissions.iterator(); while (i.hasNext()) { AccessPermission perm = (AccessPermission)i.next(); // check if this is the requested permission - if (perm.contains(domain, action, attrs)) return true; + if (perm.contains(user, domain, action, attrs)) return true; } return false; |
|
From: Michael K. <ko...@us...> - 2005-12-20 18:10:33
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/category In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23729/cobricks/category Modified Files: CategoryAccessHandler.java Log Message: Index: CategoryAccessHandler.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/category/CategoryAccessHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CategoryAccessHandler.java 23 Oct 2004 15:46:20 -0000 1.1 +++ CategoryAccessHandler.java 20 Dec 2005 18:10:23 -0000 1.2 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Cobricks Group. All rights reserved. + * 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 @@ -14,13 +14,18 @@ import java.util.*; -import org.apache.log4j.*; +import org.apache.log4j.Logger; +import org.cobricks.core.ComponentDirectory; import org.cobricks.core.CoreManager; import org.cobricks.core.db.DBAccess; import org.cobricks.core.util.LogUtil; +import org.cobricks.user.AccessControl; import org.cobricks.user.AccessHandler; import org.cobricks.user.AccessHandlerAdaptor; +import org.cobricks.user.AccessPermission; +import org.cobricks.user.User; +import org.cobricks.user.UserManager; /** * The access handler for the "category" domain - i.e. for determining who has @@ -41,20 +46,21 @@ "delete", "update" }; static final String[][] domainactionattrs = { // * - { "categoryid", "categoryclass" }, + { "categoryid", "categoryclass", "creator" }, // read - { "categoryid", "categoryclass" }, + { "categoryid", "categoryclass", "creator" }, // create { "categoryclass" }, // delete - { "categoryid", "categoryclass" }, + { "categoryid", "categoryclass", "creator" }, // update - { "categoryid", "categoryclass" } + { "categoryid", "categoryclass", "creator" } }; List actions; Map actionAttrs; + UserManager userManager; /** * @@ -78,6 +84,15 @@ } actionAttrs.put(domainactions[i], attrs); } + + try { + ComponentDirectory componentDirectory = + coreManager.getComponentDirectory(); + userManager = (UserManager) + componentDirectory.getManager("userManager"); + } catch (Throwable e) { + logger.warn("failed getting user manager"); + } } public String getDomain() @@ -102,21 +117,19 @@ // we might construct a matching select here to let the database do // some optimization ... TBD - /* // get permissions of user AccessControl ac = userManager.getAccessControl(); List permissions = ac.getAccessPermissionsByUser(userid); + User user = userManager.getUser(userid); Iterator i = permissions.iterator(); while (i.hasNext()) { AccessPermission perm = (AccessPermission)i.next(); // check if this is the requested permission - if (perm.contains(domain, action, attrs)) return true; + if (perm.contains(user, domain, action, attrs)) return true; } return false; - */ - return true; } } |
|
From: Michael K. <ko...@us...> - 2005-12-20 18:10:32
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23729/cobricks/portal Modified Files: PortalPresenter.java PortalServlet.java Log Message: Index: PortalPresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalPresenter.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- PortalPresenter.java 7 Dec 2005 14:00:50 -0000 1.33 +++ PortalPresenter.java 20 Dec 2005 18:10:24 -0000 1.34 @@ -20,7 +20,7 @@ import javax.servlet.*; import javax.servlet.http.*; -import org.apache.log4j.*; +import org.apache.log4j.Logger; import org.apache.velocity.VelocityContext; import org.apache.velocity.Template; import org.apache.velocity.app.Velocity; Index: PortalServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalServlet.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- PortalServlet.java 21 Oct 2005 15:56:46 -0000 1.39 +++ PortalServlet.java 20 Dec 2005 18:10:24 -0000 1.40 @@ -115,7 +115,14 @@ /** + * cmd = login + * parameters: luserlogin, luserpw * + * return code = + * 2201 (error): userlogin does not exist + * 2202 (error): password not correct + * 2200 (error): general error + * 1200 (success) */ public String performLogin(PortalRequest portalRequest, PrintWriter out) throws PortalCompletedException |
|
From: Michael K. <ko...@us...> - 2005-12-20 18:10:32
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23729/cobricks/core/db Modified Files: DBAccessImpl.java Log Message: Index: DBAccessImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccessImpl.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- DBAccessImpl.java 13 Dec 2005 17:07:39 -0000 1.23 +++ DBAccessImpl.java 20 Dec 2005 18:10:24 -0000 1.24 @@ -1294,6 +1294,11 @@ // check which version of the table is in the database // if it is not the newest, then update + // MYSQL: + // ALTER TABLE xxx CHANGE `x` y ytype + // Postgres: + // ALTER TABLE xxx RENAME COLUMN x TO y + return true; } |
|
From: Michael K. <ko...@us...> - 2005-12-20 18:10:32
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23729/cobricks/core Modified Files: ComponentManagerInterface.java Log Message: Index: ComponentManagerInterface.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/ComponentManagerInterface.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ComponentManagerInterface.java 29 Nov 2005 07:18:38 -0000 1.8 +++ ComponentManagerInterface.java 20 Dec 2005 18:10:24 -0000 1.9 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Cobricks Group. All rights reserved. + * Copyright (c) 2003-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 @@ -73,6 +73,6 @@ public List getCalendarEntries(int userid, Date date); - public void resetCache() ; + public void resetCache(); } |