clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1143323 - in /incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main: resources/OSGI-INF/ scala/org/apache/clerezza/platform/accountcontrolpanel/ scala/org/apache/clerezza/platform/accountco...
Date Wed, 06 Jul 2011 10:02:00 GMT
Author: reto
Date: Wed Jul  6 10:01:59 2011
New Revision: 1143323

URL: http://svn.apache.org/viewvc?rev=1143323&view=rev
Log:
CLEREZZA-591: renamed file, simplified permission superclass, made some classes inner classes

Added:
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/
      - copied from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonPanel.scala
      - copied, changed from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/person_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala
      - copied, changed from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/profile_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala
      - copied, changed from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/settings_panel.scala
Removed:
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/person_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/profile_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/settings_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/
Modified:
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_collection_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_item_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_form_panel.scala
    incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala

Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1143323&r1=1143322&r2=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml Wed Jul  6 10:01:59 2011
@@ -27,13 +27,12 @@
         <reference name="systemGraph" interface="org.apache.clerezza.rdf.core.MGraph" cardinality="1..1" policy="static" target="(name=urn:x-localinstance:/system.graph)" bind="bindSystemGraph" unbind="unbindSystemGraph"/>
         <reference name="cgProvider" interface="org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider" cardinality="1..1" policy="static" bind="bindCgProvider" unbind="unbindCgProvider"/>
     </scr:component>
-    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.pages.settings_panel">
-        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.pages.settings_panel"/>
-        <service servicefactory="false">
-            <provide interface="org.apache.clerezza.platform.typerendering.Renderlet"/>
+    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.SettingsPanel">
+        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.SettingsPanel"/>
+		<service servicefactory="false">
+            <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
         </service>
-        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.pages.settings_panel"/>
-        <reference name="renderletManager" interface="org.apache.clerezza.platform.typerendering.RenderletManager" cardinality="1..1" policy="static" bind="bindRenderletManager" unbind="unbindRenderletManager"/>
+        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.SettingsPanel"/>
     </scr:component>
 
 
@@ -55,12 +54,12 @@
         <reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
                    cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
     </scr:component>
-    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.pages.profile_panel">
-        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.pages.profile_panel"/>
+    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.ProfilePanel">
+        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.ProfilePanel"/>
         <service servicefactory="false">
             <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
         </service>
-        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.pages.profile_panel"/>
+        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.ProfilePanel"/>
     </scr:component>
 
 	<scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.FoafBrowser">
@@ -73,13 +72,13 @@
         <reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
                    cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
 	</scr:component>
-    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.pages.person_panel">
-		<implementation class="org.apache.clerezza.platform.accountcontrolpanel.pages.person_panel"/>
+    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.PersonPanel">
+		<implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.PersonPanel"/>
 		<service servicefactory="false">
 			<provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
 		</service>
 		<property name="javax.ws.rs" type="Boolean" value="true"/>
-		<property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.pages.person_panel"/>
+		<property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.PersonPanel"/>
 	</scr:component>
 
     <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.PingBack">
@@ -94,28 +93,28 @@
 
     </scr:component>
     <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.ping_back_collection_panel">
-        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_back_collection_panel"/>
+        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.ping_back_collection_panel"/>
         <service servicefactory="false">
             <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
         </service>
         <property name="javax.ws.rs" type="Boolean" value="true"/>
-        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_back_collection_panel"/>
+        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.ping_back_collection_panel"/>
     </scr:component>
-    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_back_item_panel">
-        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_back_item_panel"/>
+    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.ping_back_item_panel">
+        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.ping_back_item_panel"/>
         <service servicefactory="false">
             <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
         </service>
         <property name="javax.ws.rs" type="Boolean" value="true"/>
-        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_back_item_panel"/>
+        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.ping_back_item_panel"/>
     </scr:component>
-    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_form_panel">
-        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_form_panel"/>
+    <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.ping_form_panel">
+        <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.ping_form_panel"/>
         <service servicefactory="false">
             <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
         </service>
         <property name="javax.ws.rs" type="Boolean" value="true"/>
-        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.pages.ping_form_panel"/>
+        <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.ping_form_panel"/>
     </scr:component>
 
 </components>

Copied: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonPanel.scala (from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/person_panel.scala)
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonPanel.scala?p2=incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonPanel.scala&p1=incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/person_panel.scala&r1=1143291&r2=1143323&rev=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/person_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonPanel.scala Wed Jul  6 10:01:59 2011
@@ -1,4 +1,4 @@
-package org.apache.clerezza.platform.accountcontrolpanel.pages
+package org.apache.clerezza.platform.accountcontrolpanel.html
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -33,9 +33,9 @@ import javax.swing.UIDefaults.LazyInputM
 import org.apache.clerezza.platform.accountcontrolpanel.FoafBrowser
 
 /**
- * static methods used by person panel and that could possibly be moved to a library
+ * utility methods used by person panel
  */
-object person_panel {
+object PersonPanel {
 	val emptyText = new Text("")
 
 	def ifE[T](arg:T)(template: T=>Node ):NodeSeq = {
@@ -126,163 +126,162 @@ object person_panel {
 /**
  * Metadata class for the person panel
  */
-class person_panel extends SRenderlet {
+class PersonPanel extends SRenderlet {
 	def getRdfType() = CONTROLPANEL.ProfileViewerPage
 
 	override def renderedPage(arguments: XmlResult.Arguments) = new XmlPerson(arguments)
-}
-
-/**
- * Content class for the Person Panel
- */
-class XmlPerson(args: XmlResult.Arguments) extends XmlResult(args) {
-	import person_panel._
-
-	//
-	// Some initial constants
-	//
-
-	// either we use the rdf data on this as commented out here,
-	//	    val it: CollectedIter[RichGraphNode] = res / FOAF.primaryTopic
-	//	    val primeTpc: RichGraphNode = it.apply(0)
-	// or we can get that information from URL, as shown here
-	//lazy val webIdStr = uriInfo.getQueryParameters(true).getFirst("uri")
-	//lazy val webIdUri= new UriRef(webIdStr)
-
-	//lazy val webIdInfo =  $[WebProxy].getResourceInfo(webIdUri)
-	//lazy val agent : RichGraphNode=  $[WebProxy].fetchSemantics(webIdUri) match { case Some(grph) => grph; case None => res};
-	lazy val agent : RichGraphNode = res / FOAF.primaryTopic
-	lazy val agentDoc = FoafBrowser.removeHash(agent.getNode.asInstanceOf[UriRef]).getUnicodeString
-	lazy val user= context/platform("user")
-	lazy val username = user/platform("userName")*
-	lazy val local = username != "" && username != "anonymous"
-	//
-	// setting some header info
-	//
-
-	resultDocModifier.addStyleSheet("/account-control-panel/style/profile.css");
-	resultDocModifier.setTitle("Profile Viewer");
-	resultDocModifier.addNodes2Elem("tx-module", <h1>Profile Viewer</h1>);
-	resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Profile Viewer</a></li>);
-
-	//
-	// the content itself.
-	// This is the piece that is closest to a pure ssp, though there is still too much code in it
-	//
-
-	override def content = <div id="tx-content">
-		<h2>Profile Viewer</h2>
-		{if (local) <form action={"/user/"+username+"/profile/addContact"} method="POST">
-			<input type="submit" value="Add Contacts"/>{maintable}<input type="submit" value="Add Contacts"/>
-		</form>
-		 else maintable }
-		<code>
-			<pre>{val s = org.apache.clerezza.rdf.core.serializedform.Serializer.getInstance();
-			import java.io._
-			val bout = new ByteArrayOutputStream()
-			s.serialize(bout, agent.getGraph(), "text/rdf+n3");
-			bout.toString("UTF-8")
-			}</pre>
-		</code>
-	</div>
-
-	 def maintable = <table>
-		 {val typ: Resource = (agent / RDF.`type`).!
-		 typ match {
-			 case FOAF.Person => personHtml(agent)
-			 case FOAF.Group => groupHtml(agent)
-			 case FOAF.Agent => agentHtml(agent)
-			 case _ => allAgentsHtml(agent.getGraph)
-		 }}
-	 </table>
-
-
-
-	//
-	// Methods called by the content
-	//
-
-	def relations() = {
-		<table>{for (friend <- agent/FOAF.knows) {
-			<tr><td>{friend*}</td></tr>
-			}
-			<tr><td><form id="addContact" method="post" action="profile/people">
-			<input type="text" name="webId" size="80"/>
-			<input type="submit" value="add contact" />
-		</form></td></tr>
-		}</table>
-	}
 
+	/**
+	 * Content class for the Person Panel
+	 */
+	class XmlPerson(args: XmlResult.Arguments) extends XmlResult(args) {
+		import PersonPanel._
 
-	def allAgentsHtml(tc: TripleCollection): Node = {<span>
-		<th><tr colspan="2">All agents found</tr></th>
-		{ import collection.JavaConversions._
-		//todo: change
-		  val base = new URL(agent.getNode.asInstanceOf[UriRef].getUnicodeString());
-		  val lclPrson = for (tr: Triple <- tc.filter(null, RDF.`type`, FOAF.Person);
-				 subjUrl = try { new URL(tr.getSubject.asInstanceOf[UriRef].getUnicodeString) } catch  { case _ => null }
-				 if (subjUrl != null && base.sameFile(subjUrl))
-		  ) yield tr.getSubject
-		  for (p <- lclPrson) yield
-				<tbody>{personHtml(new GraphNode(p,tc))}</tbody>
+		//
+		// Some initial constants
+		//
+
+		// either we use the rdf data on this as commented out here,
+		//	    val it: CollectedIter[RichGraphNode] = res / FOAF.primaryTopic
+		//	    val primeTpc: RichGraphNode = it.apply(0)
+		// or we can get that information from URL, as shown here
+		//lazy val webIdStr = uriInfo.getQueryParameters(true).getFirst("uri")
+		//lazy val webIdUri= new UriRef(webIdStr)
+
+		//lazy val webIdInfo =  $[WebProxy].getResourceInfo(webIdUri)
+		//lazy val agent : RichGraphNode=  $[WebProxy].fetchSemantics(webIdUri) match { case Some(grph) => grph; case None => res};
+		lazy val agent : RichGraphNode = res / FOAF.primaryTopic
+		lazy val agentDoc = FoafBrowser.removeHash(agent.getNode.asInstanceOf[UriRef]).getUnicodeString
+		lazy val user= context/platform("user")
+		lazy val username = user/platform("userName")*
+		lazy val local = username != "" && username != "anonymous"
+		//
+		// setting some header info
+		//
+
+		resultDocModifier.addStyleSheet("/account-control-panel/style/profile.css");
+		resultDocModifier.setTitle("Profile Viewer");
+		resultDocModifier.addNodes2Elem("tx-module", <h1>Profile Viewer</h1>);
+		resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Profile Viewer</a></li>);
+
+		//
+		// the content itself.
+		// This is the piece that is closest to a pure ssp, though there is still too much code in it
+		//
+
+		override def content = <div id="tx-content">
+			<h2>Profile Viewer</h2>
+			{if (local) <form action={"/user/"+username+"/profile/addContact"} method="POST">
+				<input type="submit" value="Add Contacts"/>{maintable}<input type="submit" value="Add Contacts"/>
+			</form>
+			 else maintable }
+			<code>
+				<pre>{val s = org.apache.clerezza.rdf.core.serializedform.Serializer.getInstance();
+				import java.io._
+				val bout = new ByteArrayOutputStream()
+				s.serialize(bout, agent.getGraph(), "text/rdf+n3");
+				bout.toString("UTF-8")
+				}</pre>
+			</code>
+		</div>
+
+		 def maintable = <table>
+			 {val typ: Resource = (agent / RDF.`type`).!
+			 typ match {
+				 case FOAF.Person => personHtml(agent)
+				 case FOAF.Group => groupHtml(agent)
+				 case FOAF.Agent => agentHtml(agent)
+				 case _ => allAgentsHtml(agent.getGraph)
+			 }}
+		 </table>
+
+
+
+		//
+		// Methods called by the content
+		//
+
+		def relations() = {
+			<table>{for (friend <- agent/FOAF.knows) {
+				<tr><td>{friend*}</td></tr>
+				}
+				<tr><td><form id="addContact" method="post" action="profile/people">
+				<input type="text" name="webId" size="80"/>
+				<input type="submit" value="add contact" />
+			</form></td></tr>
+			}</table>
 		}
-	</span>}
 
-	/**
-	 * Is the uri defined here on the page from which the WebID comes?
-	 * The point of this function is not to give the user a choice of adding a person to his list
-	 * of friends, until that page has been at least once properly de-referenced. (People can link
-	 * to non existent foaf files, things that are not persons, etc...)
-	 *
-	 * For pages with multiple #uris
-	 * This will always return false for URIs that are redirected (as the foaf vocab is)
-	 *
-	 * If that is the reasoning then should we also extend this method to return true for pages already
-	 * in the cache?
-	 *
-	 */
-	def definedHere(uri: UriRef):Boolean = uri.getUnicodeString.startsWith(agentDoc)
 
+		def allAgentsHtml(tc: TripleCollection): Node = {<span>
+			<th><tr colspan="2">All agents found</tr></th>
+			{ import collection.JavaConversions._
+			//todo: change
+			  val base = new URL(agent.getNode.asInstanceOf[UriRef].getUnicodeString());
+			  val lclPrson = for (tr: Triple <- tc.filter(null, RDF.`type`, FOAF.Person);
+					 subjUrl = try { new URL(tr.getSubject.asInstanceOf[UriRef].getUnicodeString) } catch  { case _ => null }
+					 if (subjUrl != null && base.sameFile(subjUrl))
+			  ) yield tr.getSubject
+			  for (p <- lclPrson) yield
+					<tbody>{personHtml(new GraphNode(p,tc))}</tbody>
+			}
+		</span>}
 
-	def personHtml(p: RichGraphNode): NodeSeq = {
-		//note: img is a sub-relation of depiction, so an inference engine would add both, and one would end up with repetition
-		//todo: only first image is shown
-		{<tr><td colspan="2">Person</td></tr>}++
-		ifE(p!){   case u:UriRef=> if (definedHere(u))
-			<tr>{if (local) <td><input type="checkbox" name="webId" value={p*}/>Add as contact</td> else <td>WebID</td>}<td><a href={p*}>{p*}</a></td></tr>
-			else
-			<tr><td><a href=""/>Explore</td><td><a href={"person?uri="+encode(u.getUnicodeString)}>{p*}</a></td></tr>
-					  case _ => emptyText;
-		}++
-		ifE(p/FOAF.name){f=>(<tr><td>Name:</td><td>{f*}</td></tr>)}++
-		 ifE(p/FOAF.firstName){f=>(<tr><td>First Name:</td><td>{f}</td></tr>)} ++
-		 ifE(firstOf(p,FOAF.family_name,FOAF.familyName)){f=>(<tr><td>Family Name:</td><td>{f*}</td></tr>)} ++
-		 ifE(p/FOAF.mbox){f =>(<tr><td>Mbox:</td><td><ul>{for (m<-f)yield {<li><a href={m*}>{m*}</a></li>}}</ul></td></tr>)}++
-		 ifE(p/FOAF.homepage){f =>(<tr><td>Homepage:</td><td><ul>{for (x<-f)yield <li><a href={x*}>{x*}</a></li>}</ul></td></tr>)}++
-		 ifE(p/FOAF.currentProject){f =>(<tr><td>Current Project(s):</td><td><ul>{for (x<-f) yield <li>{linkNlabel(x)}</li>}</ul></td></tr>)}++
-		 ifE(p/FOAF.depiction){f=>(<tr><td>Depictions:</td><td><img src={f*} /></td></tr>)}++
-		 ifE(p/FOAF.img){f=>(<tr><td>Depictions:</td><td><img src={f*} /></td></tr>)}++
-		 ifE(p/FOAF.logo){f=>(<tr><td>Logo:</td><td><img src={f*} /></td></tr>)}++
-		 ifE(p/FOAF.knows){k=>(<tr><td>claims to know</td><td><table>{for (fr<-k) yield displayAgent(fr)}</table></td></tr>)}
-	}
+		/**
+		 * Is the uri defined here on the page from which the WebID comes?
+		 * The point of this function is not to give the user a choice of adding a person to his list
+		 * of friends, until that page has been at least once properly de-referenced. (People can link
+		 * to non existent foaf files, things that are not persons, etc...)
+		 *
+		 * For pages with multiple #uris
+		 * This will always return false for URIs that are redirected (as the foaf vocab is)
+		 *
+		 * If that is the reasoning then should we also extend this method to return true for pages already
+		 * in the cache?
+		 *
+		 */
+		def definedHere(uri: UriRef):Boolean = uri.getUnicodeString.startsWith(agentDoc)
+
+
+		def personHtml(p: RichGraphNode): NodeSeq = {
+			//note: img is a sub-relation of depiction, so an inference engine would add both, and one would end up with repetition
+			//todo: only first image is shown
+			{<tr><td colspan="2">Person</td></tr>}++
+			ifE(p!){   case u:UriRef=> if (definedHere(u))
+				<tr>{if (local) <td><input type="checkbox" name="webId" value={p*}/>Add as contact</td> else <td>WebID</td>}<td><a href={p*}>{p*}</a></td></tr>
+				else
+				<tr><td><a href=""/>Explore</td><td><a href={"person?uri="+encode(u.getUnicodeString)}>{p*}</a></td></tr>
+						  case _ => emptyText;
+			}++
+			ifE(p/FOAF.name){f=>(<tr><td>Name:</td><td>{f*}</td></tr>)}++
+			ifE(p/FOAF.firstName){f=>(<tr><td>First Name:</td><td>{f}</td></tr>)} ++
+			ifE(firstOf(p,FOAF.family_name,FOAF.familyName)){f=>(<tr><td>Family Name:</td><td>{f*}</td></tr>)} ++
+			ifE(p/FOAF.mbox){f =>(<tr><td>Mbox:</td><td><ul>{for (m<-f)yield {<li><a href={m*}>{m*}</a></li>}}</ul></td></tr>)}++
+			ifE(p/FOAF.homepage){f =>(<tr><td>Homepage:</td><td><ul>{for (x<-f)yield <li><a href={x*}>{x*}</a></li>}</ul></td></tr>)}++
+			ifE(p/FOAF.currentProject){f =>(<tr><td>Current Project(s):</td><td><ul>{for (x<-f) yield <li>{linkNlabel(x)}</li>}</ul></td></tr>)}++
+			ifE(p/FOAF.depiction){f=>(<tr><td>Depictions:</td><td><img src={f*} /></td></tr>)}++
+			ifE(p/FOAF.img){f=>(<tr><td>Depictions:</td><td><img src={f*} /></td></tr>)}++
+			ifE(p/FOAF.logo){f=>(<tr><td>Logo:</td><td><img src={f*} /></td></tr>)}++
+			ifE(p/FOAF.knows){k=>(<tr><td>claims to know</td><td><table>{for (fr<-k) yield displayAgent(fr)}</table></td></tr>)}
+		}
 
 
-	def groupHtml(grp: RichGraphNode): NodeSeq = {
-		ifE(grp/FOAF.name){f=>(<tr><td>Name:</td><td>{f}</td></tr>)}++
-		ifE(grp/FOAF.logo*){f=>(<tr><td>Logo:</td><td><img src={f} /></td></tr>)}
-	}
+		def groupHtml(grp: RichGraphNode): NodeSeq = {
+			ifE(grp/FOAF.name){f=>(<tr><td>Name:</td><td>{f}</td></tr>)}++
+			ifE(grp/FOAF.logo*){f=>(<tr><td>Logo:</td><td><img src={f} /></td></tr>)}
+		}
 
 
-	def displayAgent(agent: RichGraphNode): NodeSeq = {
-	  val typ: Resource = (agent/RDF.`type`).!
-	  return typ match {
-			case FOAF.Person => personHtml(agent)
-			case FOAF.Group => groupHtml(agent)
-			case FOAF.Agent => agentHtml(agent)
-			case _ => emptyText
-	  }
-	}
+		def displayAgent(agent: RichGraphNode): NodeSeq = {
+		  val typ: Resource = (agent/RDF.`type`).!
+		  return typ match {
+				case FOAF.Person => personHtml(agent)
+				case FOAF.Group => groupHtml(agent)
+				case FOAF.Agent => agentHtml(agent)
+				case _ => emptyText
+		  }
+		}
 
 
+	}
 }
-

Copied: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala (from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/profile_panel.scala)
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala?p2=incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala&p1=incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/profile_panel.scala&r1=1143291&r2=1143323&rev=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/profile_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala Wed Jul  6 10:01:59 2011
@@ -1,4 +1,4 @@
-package org.apache.clerezza.platform.accountcontrolpanel.pages
+package org.apache.clerezza.platform.accountcontrolpanel.html
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -31,250 +31,251 @@ import org.apache.clerezza.rdf.core.UriR
 import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
 import org.apache.clerezza.rdf.ontologies.{RDFS, DC, FOAF}
 
-class profile_panel extends SRenderlet {
-  override def getRdfType() = CONTROLPANEL.ProfilePage
+class ProfilePanel extends SRenderlet {
 
-  override def renderedPage(arguments: XmlResult.Arguments) = new ProfilePanelXHTML(arguments)
-}
-
-class ProfilePanelXHTML(arguments: XmlResult.Arguments) extends XmlResult(arguments ) {
-
-	//set header properties
-
- 	resultDocModifier.addStyleSheet("/account-control-panel/style/profile.css");
-	resultDocModifier.addScriptReference("/account-control-panel/scripts/profile.js");
-	resultDocModifier.addScriptReference("/account-control-panel/scripts/IEKeygen.js");
-	resultDocModifier.setTitle("Account Control Panel");
-	resultDocModifier.addNodes2Elem("tx-module", <h1>Account Control Panel</h1>);
-	resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Profile</a></li>);
-	resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="control-panel">Settings</a></li>);
-
-	//constants and variables
-
-	lazy val agent: RichGraphNode = res / FOAF.primaryTopic
-
-
-	// the content itself
-	// clearly in this case there is so much more in the the methods, that one could hesitate to call this an ssp
-
-	override def content = {
-	  <div id="tx-content">
-		  <h2>Personal Profile</h2>{agent ! match {
-				case _: BNode => createWebId()
-				case _: UriRef => existingWebId()
-			 }}
-	  </div>
-
-	}
-
-	//methods used to create content
+	override def getRdfType() = CONTROLPANEL.ProfilePage
 
-	def cp(s: Any) =  new UriRef("http://clerezza.org/2009/03/controlpanel#" + s)
-	def platform(s: Any) = new UriRef("http://clerezza.org/2009/08/platform#" + s)
+	override def renderedPage(arguments: XmlResult.Arguments) = new ProfilePanelXHTML(arguments)
 
+	class ProfilePanelXHTML(arguments: XmlResult.Arguments) extends XmlResult(arguments ) {
 
-	def createWebId() = {
-	  <h3>Associate Profile to WebID</h3>
-	  <div id="newOrExistingSelection">
-		<p>Your profile is not currently associated to a WebID. A WebID allows you
-		  to link your friends as well as to log-in to many sites (supporting foaf+ssl
-		  or open-id).
-		</p>
-		<p>You may either create a new WebID or associate your account to an
-		  existing WebID. Only creating a WebID here will allow you to manage your
-		  profile here.
-		</p>
-		<form action="#" id="associateSelection">
-		  <button type="button" id="newWebIdButton">Create a new Web-Id</button>
-		  <button type="button" id="existingWebIdButton">I already have a Web-ID and want to use it</button>
-		</form>
-	  </div>
-	  <div id="createNewWebId">
-		<p>You have chosen to create a new Web-Id.</p>
-		<p>The Web-ID will be created as follows:
-		  <br/>
-		  <ol>
-			<li>Web-Id:
-			  {var webId = res / cp("suggestedPPDUri") *;
-				webId += "#me";
-				webId}
-			</li>
-			<li>Personal-Profile Document: {res/cp("suggestedPPDUri")*}</li>
-		  </ol>
-		</p>
-		<form method="post" action="profile/create-new-web-id">
-		  <input value="Create it!" type="submit"/>
-		</form>
-	  </div>
-	  <div id="setExistingWebId">
-		<p>Please enter your Web-Id, if your Web-Id supports Foaf+SSL you will
-		  be able to use it to log in to this site.</p>
-		<form method="post" action="profile/set-existing-webid">
-		  <label for="webid">WebID</label> <input type="text" name="webid" size="80" title="Web-ID"/>
-		  <br/>
-		  <input value="Associate Profile to Web-Id" type="submit"/>
-		  <p/>
-		</form>
-	  </div>
-
-	}
-
-	def existingWebId() = {
-	  if ((res / cp("isLocalProfile")).as[Boolean]) {
-		existingLocalWebId()
-	  } else {
-		roamingUser()
+		//set header properties
+
+		resultDocModifier.addStyleSheet("/account-control-panel/style/profile.css");
+		resultDocModifier.addScriptReference("/account-control-panel/scripts/profile.js");
+		resultDocModifier.addScriptReference("/account-control-panel/scripts/IEKeygen.js");
+		resultDocModifier.setTitle("Account Control Panel");
+		resultDocModifier.addNodes2Elem("tx-module", <h1>Account Control Panel</h1>);
+		resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Profile</a></li>);
+		resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="control-panel">Settings</a></li>);
+
+		//constants and variables
+
+		lazy val agent: RichGraphNode = res / FOAF.primaryTopic
+
+
+		// the content itself
+		// clearly in this case there is so much more in the the methods, that one could hesitate to call this an ssp
+
+		override def content = {
+		  <div id="tx-content">
+			  <h2>Personal Profile</h2>{agent ! match {
+					case _: BNode => createWebId()
+					case _: UriRef => existingWebId()
+				 }}
+		  </div>
+
+		}
+
+		//methods used to create content
+
+		def cp(s: Any) =  new UriRef("http://clerezza.org/2009/03/controlpanel#" + s)
+		def platform(s: Any) = new UriRef("http://clerezza.org/2009/08/platform#" + s)
+
+
+		def createWebId() = {
+		  <h3>Associate Profile to WebID</h3>
+		  <div id="newOrExistingSelection">
+			<p>Your profile is not currently associated to a WebID. A WebID allows you
+			  to link your friends as well as to log-in to many sites (supporting foaf+ssl
+			  or open-id).
+			</p>
+			<p>You may either create a new WebID or associate your account to an
+			  existing WebID. Only creating a WebID here will allow you to manage your
+			  profile here.
+			</p>
+			<form action="#" id="associateSelection">
+			  <button type="button" id="newWebIdButton">Create a new Web-Id</button>
+			  <button type="button" id="existingWebIdButton">I already have a Web-ID and want to use it</button>
+			</form>
+		  </div>
+		  <div id="createNewWebId">
+			<p>You have chosen to create a new Web-Id.</p>
+			<p>The Web-ID will be created as follows:
+			  <br/>
+			  <ol>
+				<li>Web-Id:
+				  {var webId = res / cp("suggestedPPDUri") *;
+					webId += "#me";
+					webId}
+				</li>
+				<li>Personal-Profile Document: {res/cp("suggestedPPDUri")*}</li>
+			  </ol>
+			</p>
+			<form method="post" action="profile/create-new-web-id">
+			  <input value="Create it!" type="submit"/>
+			</form>
+		  </div>
+		  <div id="setExistingWebId">
+			<p>Please enter your Web-Id, if your Web-Id supports Foaf+SSL you will
+			  be able to use it to log in to this site.</p>
+			<form method="post" action="profile/set-existing-webid">
+			  <label for="webid">WebID</label> <input type="text" name="webid" size="80" title="Web-ID"/>
+			  <br/>
+			  <input value="Associate Profile to Web-Id" type="submit"/>
+			  <p/>
+			</form>
+		  </div>
+
+		}
+
+		def existingWebId() = {
+		  if ((res / cp("isLocalProfile")).as[Boolean]) {
+			existingLocalWebId()
+		  } else {
+			roamingUser()
+		  }
+		}
+
+
+		def existingLocalWebId() = {
+		  <h3>Manage your profile</h3>
+			 <p>Here you can change your public profile.</p>
+
+		  <form method="post" action="profile/modify">
+			<input type="hidden" name="webId" value={agent *}/>
+			<table>
+			  <tr><td class="formlabel">Name:</td>
+				<td><input type="text" name="name" value={agent / FOAF.name *}/></td>
+			  </tr>
+			  <tr><td class="formlabel multiline">Description:</td>
+				<td><textarea name="description" rows="3" cols="80">{agent / DC.description *}</textarea></td>
+			  </tr>
+			  <tr><td class="formlabel"><input value="Modify" type="submit"/></td><td/></tr>
+			</table>
+
+			<p/>
+		  </form>
+
+		  <h3>Contacts</h3>
+		  <form id="addContact" method="get" action="/browse/person">
+		  <table>{ var i =0
+			  val friends = for (friend <- agent/FOAF.knows) yield {
+			  import PersonPanel._
+			  <td class="personInABox">{personInABox(friend)}</td>
+			 }
+			 for (row <- friends.grouped(5)) yield <tr>{row}</tr>
+		  }</table>
+		  <input type="text" name="uri" size="80"/><input type="submit" value="add contact" />
+		  </form>
+
+		  <h3>Key and Certificate Creation</h3>
+
+		  <script type="text/javascript"> <![CDATA[$(document).ready(  function() { configurePage(); }   ); ]]> </script>
+
+		  <div id="iehelptext" style="display: none;">
+			<p>Using Internet Explorer under Windows Vista or above or Windows
+			  Server 2008, you need to configure the following for this to work:</p>
+			<ul>
+			  <li>Add this site to the <i>Trusted Sites</i> list: in Internet
+				Options -&gt; Security -&gt; Trusted Sites -&gt; Sites -&gt; Add ...</li>
+			  <li>You may need to configure the trust level (in this tab), using
+				<i>Custom Level...</i>: enable <i>Initialize and script ActiveX
+				  controls not marked as safe for scripting</i>.</li>
+			  <li>If you are using Windows Vista without SP1 or above, you will
+				probably need to install <a href="cacert.crt">this certificate</a> as a
+				Trusted Root Certification Authority Certificate for your own
+				certificate installation to succeed. You should probably remove that
+				trusted root CA certificate afterwards.</li>
+			</ul>
+		  </div>
+		  <form id="keygenform" method="post" action="profile/keygen">
+			<input name="webId" id="webId" type="hidden" value={agent*} />
+			<table>
+			  <colgroup><col width="1*"/><col/></colgroup>
+			  <tr>
+				<td class="formlabel">Certificate Name:</td>
+				<td>
+				  <input alt="create a certificate name that will help you distinguish it from others you may have" name="cn"
+							size="35" id="cn" type="text" value={ ((agent/FOAF.name*)+"@clerezza")}/>
+				</td>
+			  </tr>
+			  <tr>
+				<td class="formlabel">Key strength:</td>
+				<td id="keystrenghtd">
+				  <keygen id="spkac" name="spkac" challenge="TheChallenge1"/>
+				</td>
+			  </tr>
+			  <tr>
+				<td class="formlabel">Valid for:</td>
+				<td>
+				  <input type="text" name="days" value="365" size="4"/>
+				  days <input type="text" name="hours" value="0.0" size="4"/> hours</td>
+			  </tr>
+			  <tr>
+				<td class="formlabel">Comment:</td>
+				<td><input type="text" name="comment" value="" size="80"/></td>
+			  </tr>
+			  <tr><td class="formlabel"><input id="keygensubmit" type="submit" value="create certificate" /></td><td/></tr>
+			</table>
+		  </form>
+		  <h3>Existing Certificates</h3>
+		  <form method="post" action="profile/deletekey">
+			<table>
+			  <tr><th>Delete</th><th>Certificate Details</th></tr>
+			  <input name="webId" id="webId" type="hidden" value={agent*} />
+			  <tbody>{
+				  for (key <- agent/-CERT.identity )
+					yield { val modulus = (key/RSA.modulus).as[BigInteger]
+							if (modulus == null)  <span/> //todo: broken public key, should delete it
+							else <tr><td><input type="checkbox" name="keyhash" value={modulus.hashCode().toString()}/></td>
+						<td><table>
+							<tr><td class="propvalue">Created:</td><td>{beautifyDate(key/DC.date )}</td></tr>
+							<tr><td class="propvalue">Comment:</td><td>{ key/RDFS.comment* }</td></tr>
+							<tr><td class="propvalue multiline">Modulus:</td><td><code>{ beautifyHex(key/RSA.modulus) }</code></td></tr>
+							<tr><td class="propvalue">Exponent:</td><td><code>{ beautifyInt(key/RSA.public_exponent) }</code></td></tr>
+							</table>
+						</td>
+								</tr>}
+				}</tbody>
+			</table>
+			<input type="submit" value="Disable Keys"/>
+		  </form>
+		  <p></p>
+
+		}
+
+		def roamingUser() = {
+		  <h3>Using remote profile</h3>
+			 <p>
+			{agent / FOAF.nick *}, you have accessed this site using your WebID
+				{"<" + (agent *) + ">"}
+				which has not been
+				created on this site.To edit your profile you should visit the site issuing the
+				profile.</p>
+		}
+
+
+
+
+	  def beautifyDate(dtIt: CollectedIter[RichGraphNode]) {
+		  if (0 == dtIt.size) return "_"
+		  DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.FULL).format(dtIt.as[Date])
 	  }
-	}
-
-
-	def existingLocalWebId() = {
-	  <h3>Manage your profile</h3>
-		 <p>Here you can change your public profile.</p>
-
-	  <form method="post" action="profile/modify">
-		<input type="hidden" name="webId" value={agent *}/>
-		<table>
-		  <tr><td class="formlabel">Name:</td>
-			<td><input type="text" name="name" value={agent / FOAF.name *}/></td>
-		  </tr>
-		  <tr><td class="formlabel multiline">Description:</td>
-			<td><textarea name="description" rows="3" cols="80">{agent / DC.description *}</textarea></td>
-		  </tr>
-		  <tr><td class="formlabel"><input value="Modify" type="submit"/></td><td/></tr>
-		</table>
-
-		<p/>
-	  </form>
-
-	  <h3>Contacts</h3>
-	  <form id="addContact" method="get" action="/browse/person">
-	  <table>{ var i =0
-		  val friends = for (friend <- agent/FOAF.knows) yield {
-		  import person_panel._
-		  <td class="personInABox">{personInABox(friend)}</td>
-		 }
-		 for (row <- friends.grouped(5)) yield <tr>{row}</tr>
-	  }</table>
-	  <input type="text" name="uri" size="80"/><input type="submit" value="add contact" />
-	  </form>
-
-	  <h3>Key and Certificate Creation</h3>
-
-	  <script type="text/javascript"> <![CDATA[$(document).ready(  function() { configurePage(); }   ); ]]> </script>
-
-	  <div id="iehelptext" style="display: none;">
-		<p>Using Internet Explorer under Windows Vista or above or Windows
-		  Server 2008, you need to configure the following for this to work:</p>
-		<ul>
-		  <li>Add this site to the <i>Trusted Sites</i> list: in Internet
-			Options -&gt; Security -&gt; Trusted Sites -&gt; Sites -&gt; Add ...</li>
-		  <li>You may need to configure the trust level (in this tab), using
-			<i>Custom Level...</i>: enable <i>Initialize and script ActiveX
-			  controls not marked as safe for scripting</i>.</li>
-		  <li>If you are using Windows Vista without SP1 or above, you will
-			probably need to install <a href="cacert.crt">this certificate</a> as a
-			Trusted Root Certification Authority Certificate for your own
-			certificate installation to succeed. You should probably remove that
-			trusted root CA certificate afterwards.</li>
-		</ul>
-	  </div>
-	  <form id="keygenform" method="post" action="profile/keygen">
-		<input name="webId" id="webId" type="hidden" value={agent*} />
-		<table>
-		  <colgroup><col width="1*"/><col/></colgroup>
-		  <tr>
-			<td class="formlabel">Certificate Name:</td>
-			<td>
-			  <input alt="create a certificate name that will help you distinguish it from others you may have" name="cn"
-						size="35" id="cn" type="text" value={ ((agent/FOAF.name*)+"@clerezza")}/>
-			</td>
-		  </tr>
-		  <tr>
-			<td class="formlabel">Key strength:</td>
-			<td id="keystrenghtd">
-			  <keygen id="spkac" name="spkac" challenge="TheChallenge1"/>
-			</td>
-		  </tr>
-		  <tr>
-			<td class="formlabel">Valid for:</td>
-			<td>
-			  <input type="text" name="days" value="365" size="4"/>
-			  days <input type="text" name="hours" value="0.0" size="4"/> hours</td>
-		  </tr>
-		  <tr>
-			<td class="formlabel">Comment:</td>
-			<td><input type="text" name="comment" value="" size="80"/></td>
-		  </tr>
-		  <tr><td class="formlabel"><input id="keygensubmit" type="submit" value="create certificate" /></td><td/></tr>
-		</table>
-	  </form>
-	  <h3>Existing Certificates</h3>
-	  <form method="post" action="profile/deletekey">
-		<table>
-		  <tr><th>Delete</th><th>Certificate Details</th></tr>
-		  <input name="webId" id="webId" type="hidden" value={agent*} />
-		  <tbody>{
-			  for (key <- agent/-CERT.identity )
-				yield { val modulus = (key/RSA.modulus).as[BigInteger]
-						if (modulus == null)  <span/> //todo: broken public key, should delete it
-						else <tr><td><input type="checkbox" name="keyhash" value={modulus.hashCode().toString()}/></td>
-					<td><table>
-						<tr><td class="propvalue">Created:</td><td>{beautifyDate(key/DC.date )}</td></tr>
-						<tr><td class="propvalue">Comment:</td><td>{ key/RDFS.comment* }</td></tr>
-						<tr><td class="propvalue multiline">Modulus:</td><td><code>{ beautifyHex(key/RSA.modulus) }</code></td></tr>
-						<tr><td class="propvalue">Exponent:</td><td><code>{ beautifyInt(key/RSA.public_exponent) }</code></td></tr>
-						</table>
-					</td>
-							</tr>}
-			}</tbody>
-		</table>
-		<input type="submit" value="Disable Keys"/>
-	  </form>
-	  <p></p>
 
-	}
-
-	def roamingUser() = {
-	  <h3>Using remote profile</h3>
-		 <p>
-		{agent / FOAF.nick *}, you have accessed this site using your WebID
-			{"<" + (agent *) + ">"}
-			which has not been
-			created on this site.To edit your profile you should visit the site issuing the
-			profile.</p>
-	}
 
+	  def beautifyHex(dtIt: CollectedIter[RichGraphNode]): String = {
+		  if (0 == dtIt.size) return "warning! missing. Key invalid"
+		  //this is a problem, it should always be here or it is invalid, and key should be removed
+		  val bigint: BigInteger = dtIt.as[BigInteger]
+		  val bstr = bigint.toString(16).toUpperCase;
+		  val sbuf = new StringBuffer(bstr.size + (bstr.size/2)+10)
+		  var cnt = 0
+		  for (c <- bstr.toCharArray) {
+			if ((cnt % 2) == 0) sbuf.append(' ')
+			sbuf.append(c)
+			cnt += 1
+		  }
+		  sbuf.toString
+		}
 
 
 
-  def beautifyDate(dtIt: CollectedIter[RichGraphNode]) {
-	  if (0 == dtIt.size) return "_"
-	  DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.FULL).format(dtIt.as[Date])
-  }
-
-
-  def beautifyHex(dtIt: CollectedIter[RichGraphNode]): String = {
-	  if (0 == dtIt.size) return "warning! missing. Key invalid"
-	  //this is a problem, it should always be here or it is invalid, and key should be removed
-	  val bigint: BigInteger = dtIt.as[BigInteger]
-	  val bstr = bigint.toString(16).toUpperCase;
-	  val sbuf = new StringBuffer(bstr.size + (bstr.size/2)+10)
-	  var cnt = 0
-	  for (c <- bstr.toCharArray) {
-		if ((cnt % 2) == 0) sbuf.append(' ')
-		sbuf.append(c)
-		cnt += 1
+	  def beautifyInt(dtIt: CollectedIter[RichGraphNode] ) :String = {
+		  if (0 == dtIt.size) return "warning! missing. Key invalid"
+		  else return dtIt.as[BigInteger].toString
 	  }
-	  sbuf.toString
 	}
-
-
-
-  def beautifyInt(dtIt: CollectedIter[RichGraphNode] ) :String = {
-	  if (0 == dtIt.size) return "warning! missing. Key invalid"
-	  else return dtIt.as[BigInteger].toString
-  }
 }
 
 

Copied: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala (from r1143291, incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/settings_panel.scala)
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala?p2=incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala&p1=incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/settings_panel.scala&r1=1143291&r2=1143323&rev=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/pages/settings_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala Wed Jul  6 10:01:59 2011
@@ -17,22 +17,19 @@
  * under the License.
  */
 
-package org.apache.clerezza.platform.accountcontrolpanel.pages
+package org.apache.clerezza.platform.accountcontrolpanel.html
 
 import org.apache.clerezza.rdf.scala.utils.Preamble._
 import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
 import org.apache.clerezza.platform.typerendering.scala._
 
 
-class settings_panel extends PageRenderlet {
+class SettingsPanel extends SRenderlet {
 
-	val rdfType = CONTROLPANEL.SettingsPage
-	override def mode = "naked"
+	val getRdfType = CONTROLPANEL.SettingsPage
 
-  	override def renderedPage(arguments: RenderedPage.Arguments): RenderedPage = {
- 		new RenderedPage(arguments) {
-
-			override def content = {
+  	override def renderedPage(arguments: XmlResult.Arguments) = new XmlResult(arguments ) {
+		override def content = {
 import org.apache.clerezza.rdf.core.UriRef
 import scala.xml.NodeBuffer
 import scala.collection.mutable.ListBuffer
@@ -161,7 +158,6 @@ nodeBuff +=(<h2>Change user's default la
 	}
 	</div>
 </div>
-      }
-    }
-  }
+		}
+	}
 }

Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_collection_panel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_collection_panel.scala?rev=1143323&r1=1143291&r2=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_collection_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_collection_panel.scala Wed Jul  6 10:01:59 2011
@@ -1,4 +1,4 @@
-package org.apache.clerezza.platform.accountcontrolpanel.pages
+package org.apache.clerezza.platform.accountcontrolpanel.html
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_item_panel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_item_panel.scala?rev=1143323&r1=1143291&r2=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_item_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_back_item_panel.scala Wed Jul  6 10:01:59 2011
@@ -1,4 +1,4 @@
-package org.apache.clerezza.platform.accountcontrolpanel.pages
+package org.apache.clerezza.platform.accountcontrolpanel.html
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_form_panel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_form_panel.scala?rev=1143323&r1=1143291&r2=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_form_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ping_form_panel.scala Wed Jul  6 10:01:59 2011
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.clerezza.platform.accountcontrolpanel.pages
+package org.apache.clerezza.platform.accountcontrolpanel.html
 
 
 import org.apache.clerezza.platform.accountcontrolpanel.ontologies.PINGBACK
@@ -82,8 +82,8 @@ class XmlPingForm(args: XmlResult.Argume
        //todo: add code in case to is on the document, not the object
 		<div id="tx-content">
 			<h2>Ping</h2>
-			<p>Ping {person_panel.getName(target)}
-			</p>{person_panel.getAgentPix(target)}
+			<p>Ping {PersonPanel.getName(target)}
+			</p>{PersonPanel.getAgentPix(target)}
 			<p>About
 				{source}
 			</p>

Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala?rev=1143323&r1=1143322&r2=1143323&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala Wed Jul  6 10:01:59 2011
@@ -20,58 +20,51 @@
 package org.apache.clerezza.platform.accountcontrolpanel
 
 import java.security.Permission
-import org.slf4j.{Logger, LoggerFactory}
+import org.slf4j.scala.Logging
 
 //note: file has lower class name, as it contains many classes
 
-/**
- *
- *
- * @author bblfish
- */
-
-object AbstractPermission {
-	private  val logger: Logger = LoggerFactory.getLogger(classOf[AbstractPermission])
-}
 
 /**
  * superclass for the permission classes, to avoid a lot of boilerplate code
  *
- * @author bblfish
+ * @author bblfish, reto
  */
-
-
 abstract
-class AbstractPermission(val accountName: String, val actions: String ="") extends Permission(accountName)  {
-	import AbstractPermission.logger
+class AbstractPermission(val accountName: String, val actions: String ="")
+	extends Permission(accountName) with Logging  {
+
+	if (actions != "") {
+		throw new RuntimeException(getClass.getName+": actions must be an empty String "+
+			"(second argument only in constructor for supporting building from canonical form")
+	}
 
 	def getActions: String = actions
 
 	/**
-	 * this overriding this method, one should create a canEquals method as described in "Programming in Scala" Book
-	 * by Martin Odersky, Lex Spoon, Bill Venners
+	 * A subclass implies another permission if and only if they are equals
 	 */
-	def canEqual(other: Any): Boolean
-
    override
 	def implies(permission: Permission): Boolean = {
-		logger.debug("checking for {} in {}", permission, this)
+		logger.debug("checking for "+permission+" is implied by "+ this)
 		var result: Boolean = equals(permission)
-		logger.debug("result {}", result)
 		return result
 	}
 
 	override
 	def equals(other: Any): Boolean =
 	    other match {
-			case that:  AbstractPermission  =>  ( that eq this ) || ( that.canEqual(this) && accountName == that.accountName )
+			case that:  AbstractPermission  =>  
+				(that eq this ) || ((this.getClass == that.getClass) && accountName == that.accountName )
 			case _ => false
 	    }
 
-  //todo: the hashes for same named account names of different types would be the same here
+	/**
+	 * For the hashCode the class and the accountName is considered
+	 */
 	override
 	def hashCode: Int = {
-		return  41 * (41 + (if (accountName != null) accountName.hashCode else 0))
+		return  getClass.hashCode + (if (accountName != null) accountName.hashCode else 0)
 	}
 }
 
@@ -83,9 +76,6 @@ class AbstractPermission(val accountName
 class ChangePasswordPermission(accountName: String, actions: String ="")
 	extends AbstractPermission(accountName, actions) {
 
-	def canEqual(other: Any): Boolean = other.isInstanceOf[ChangePasswordPermission]
-
-
 }
 
 /**
@@ -97,7 +87,6 @@ class ChangePasswordPermission(accountNa
 class AccountControlPanelAppPermission(accountName: String, actions: String ="")
 	extends AbstractPermission(accountName)  {
 
-	def canEqual(other: Any): Boolean = other.isInstanceOf[AccountControlPanelAppPermission]
 
 }
 
@@ -110,6 +99,5 @@ class AccountControlPanelAppPermission(a
 class UserBundlePermission( accountName: String, actions: String ="")
 	extends AbstractPermission(accountName)  {
 
-	def canEqual(other: Any): Boolean = other.isInstanceOf[UserBundlePermission]
 
 }
\ No newline at end of file



Mime
View raw message