Author: simoneg
Date: Tue Jul 21 01:42:01 2009
New Revision: 796111

URL: http://svn.apache.org/viewvc?rev=796111&view=rev
Log:
LABS-393 : missing Apache headers

Modified:
    
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/EmptyAdsTemplate.java
    
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/InterceptAds.aj
    
labs/magma/trunk/fragment-google-ads-xhtml/src/main/resources/org/apache/magma/web/google/ads/emptyAdsTemplate.html
    
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/AddGoogleAnalyticsIntoRoot.aj
    
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/GoogleAnalyticsWebHandler.java
    
labs/magma/trunk/fragment-user-domain/src/main/java/org/apache/magma/domain/user/User.java
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/AdminOnlyToAdmins.aj
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallAdminCruds.aj
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallUserHandlerIntoRoot.aj
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginRequest.java
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginWebHandler.java
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/PasswordRequest.java
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/SettingsWebHandler.java
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserCrud.java
    
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java

Modified: 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/EmptyAdsTemplate.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/EmptyAdsTemplate.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/EmptyAdsTemplate.java
 (original)
+++ 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/EmptyAdsTemplate.java
 Tue Jul 21 01:42:01 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.magma.web.google.ads;
 
 import org.apache.magma.website.templating.Template;

Modified: 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/InterceptAds.aj
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/InterceptAds.aj?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/InterceptAds.aj
 (original)
+++ 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/java/org/apache/magma/web/google/ads/InterceptAds.aj
 Tue Jul 21 01:42:01 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.magma.web.google.ads;
 
 import org.apache.magma.website.HtmlProducer;

Modified: 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/resources/org/apache/magma/web/google/ads/emptyAdsTemplate.html
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-google-ads-xhtml/src/main/resources/org/apache/magma/web/google/ads/emptyAdsTemplate.html?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/resources/org/apache/magma/web/google/ads/emptyAdsTemplate.html
 (original)
+++ 
labs/magma/trunk/fragment-google-ads-xhtml/src/main/resources/org/apache/magma/web/google/ads/emptyAdsTemplate.html
 Tue Jul 21 01:42:01 2009
@@ -1,4 +1,20 @@
 
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
 <html lang="en">
   <head>
     <title>Ads</title>
@@ -29,4 +45,4 @@
                document.body.style.overflow = 'hidden';
        </script>
   </body>
-</html>
\ No newline at end of file
+</html>

Modified: 
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/AddGoogleAnalyticsIntoRoot.aj
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/AddGoogleAnalyticsIntoRoot.aj?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/AddGoogleAnalyticsIntoRoot.aj
 (original)
+++ 
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/AddGoogleAnalyticsIntoRoot.aj
 Tue Jul 21 01:42:01 2009
@@ -1,19 +1,35 @@
-package org.apache.magma.web.google.analytics;
-
-
-
-import org.apache.magma.website.RootWebHandler;
-import org.apache.magma.website.templating.Template;
-import org.apache.magma.web.google.analytics.GoogleAnalyticsWebHandler;
-
-public privileged aspect AddGoogleAnalyticsIntoRoot {
-       
-       public GoogleAnalyticsWebHandler RootWebHandler.handleGoogleAnalytics() 
{
-               return new GoogleAnalyticsWebHandler();
-       }
-               
-       after(Template tpl) : execution(* Template.layoutExtraContent()) && 
this(tpl) && within(Template) {
-               
tpl.byDefault(GoogleAnalyticsWebHandler.class,(tpl.root().handleGoogleAnalytics().doGoogleAnalytics()));
-               
-       }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.google.analytics;
+
+
+
+import org.apache.magma.website.RootWebHandler;
+import org.apache.magma.website.templating.Template;
+import org.apache.magma.web.google.analytics.GoogleAnalyticsWebHandler;
+
+public privileged aspect AddGoogleAnalyticsIntoRoot {
+       
+       public GoogleAnalyticsWebHandler RootWebHandler.handleGoogleAnalytics() 
{
+               return new GoogleAnalyticsWebHandler();
+       }
+               
+       after(Template tpl) : execution(* Template.layoutExtraContent()) && 
this(tpl) && within(Template) {
+               
tpl.byDefault(GoogleAnalyticsWebHandler.class,(tpl.root().handleGoogleAnalytics().doGoogleAnalytics()));
+               
+       }
+}

Modified: 
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/GoogleAnalyticsWebHandler.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/GoogleAnalyticsWebHandler.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/GoogleAnalyticsWebHandler.java
 (original)
+++ 
labs/magma/trunk/fragment-google-analytics/src/main/java/org/apache/magma/web/google/analytics/GoogleAnalyticsWebHandler.java
 Tue Jul 21 01:42:01 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.magma.web.google.analytics;
 
 import org.apache.magma.settings.Settings;

Modified: 
labs/magma/trunk/fragment-user-domain/src/main/java/org/apache/magma/domain/user/User.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-domain/src/main/java/org/apache/magma/domain/user/User.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-domain/src/main/java/org/apache/magma/domain/user/User.java
 (original)
+++ 
labs/magma/trunk/fragment-user-domain/src/main/java/org/apache/magma/domain/user/User.java
 Tue Jul 21 01:42:01 2009
@@ -1,121 +1,137 @@
-package org.apache.magma.domain.user;
-
-
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Transient;
-
-import org.apache.magma.beans.MagmaBean;
-import org.apache.magma.validation.validators.Email;
-import org.apache.magma.validation.validators.Length;
-import org.apache.magma.validation.validators.Required;
-import org.apache.magma.view.After;
-import org.apache.magma.view.ListOrder;
-import org.apache.magma.view.Listed;
-import org.apache.magma.view.Order;
-import org.apache.magma.view.View;
-
-
-...@magmabean
-...@entity
-public class User {
-       private int id;
-       private String name;
-       private String surname;
-       private String email;
-       private String password;
-       private String confirmPassword;
-       private boolean active;
-       private boolean admin;
-       
-       @Id
-       @GeneratedValue
-       public int getId() {
-               return id;
-       }
-       protected void setId(int id) {
-               this.id = id;
-       }
-       
-       @View
-       @Order(1)
-       @Required
-       @Listed
-       @ListOrder(1)
-       public String getName() {
-               return name;
-       }
-       public void setName(String name) {
-               this.name = name;
-       }
-       
-       @View
-       @After("name")
-       @Required
-       @Listed
-       @ListOrder(2)
-       public String getSurname() {
-               return surname;
-       }
-       public void setSurname(String surname) {
-               this.surname = surname;
-       }
-       
-       @View
-       @Order(3)
-       @Required
-       @Column(unique=true)
-       @Email
-       public String getEmail() {
-               return email;
-       }
-       public void setEmail(String email) {
-               this.email = email;
-       }
-       
-       @View(password=true)
-       @Order(4)
-       @Required
-       @Length(min=4)
-       public String getPassword() {
-               return password;
-       }
-       public void setPassword(String password) {
-               this.password = password;
-       }
-       
-       @View(password=true)
-       @Transient
-       @Order(5)
-       @Required
-       @Length(min=4)
-       public String getConfirmPassword() {
-               return confirmPassword;
-       }
-       public void setConfirmPassword(String confirmPassword) {
-               this.confirmPassword = confirmPassword;
-       }
-       
-       
-       @View
-       @Order(6)       
-       public boolean isActive() {
-               return active;
-       }
-       public void setActive(boolean active) {
-               this.active = active;
-       }
-       @View
-       @Order(7)       
-       public boolean isAdmin() {
-               return admin;
-       }
-       public void setAdmin(boolean admin) {
-               this.admin = admin;
-       }
-       
-       
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.domain.user;
+
+
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Transient;
+
+import org.apache.magma.beans.MagmaBean;
+import org.apache.magma.validation.validators.Email;
+import org.apache.magma.validation.validators.Length;
+import org.apache.magma.validation.validators.Required;
+import org.apache.magma.view.After;
+import org.apache.magma.view.ListOrder;
+import org.apache.magma.view.Listed;
+import org.apache.magma.view.Order;
+import org.apache.magma.view.View;
+
+
+...@magmabean
+...@entity
+public class User {
+       private int id;
+       private String name;
+       private String surname;
+       private String email;
+       private String password;
+       private String confirmPassword;
+       private boolean active;
+       private boolean admin;
+       
+       @Id
+       @GeneratedValue
+       public int getId() {
+               return id;
+       }
+       protected void setId(int id) {
+               this.id = id;
+       }
+       
+       @View
+       @Order(1)
+       @Required
+       @Listed
+       @ListOrder(1)
+       public String getName() {
+               return name;
+       }
+       public void setName(String name) {
+               this.name = name;
+       }
+       
+       @View
+       @After("name")
+       @Required
+       @Listed
+       @ListOrder(2)
+       public String getSurname() {
+               return surname;
+       }
+       public void setSurname(String surname) {
+               this.surname = surname;
+       }
+       
+       @View
+       @Order(3)
+       @Required
+       @Column(unique=true)
+       @Email
+       public String getEmail() {
+               return email;
+       }
+       public void setEmail(String email) {
+               this.email = email;
+       }
+       
+       @View(password=true)
+       @Order(4)
+       @Required
+       @Length(min=4)
+       public String getPassword() {
+               return password;
+       }
+       public void setPassword(String password) {
+               this.password = password;
+       }
+       
+       @View(password=true)
+       @Transient
+       @Order(5)
+       @Required
+       @Length(min=4)
+       public String getConfirmPassword() {
+               return confirmPassword;
+       }
+       public void setConfirmPassword(String confirmPassword) {
+               this.confirmPassword = confirmPassword;
+       }
+       
+       
+       @View
+       @Order(6)       
+       public boolean isActive() {
+               return active;
+       }
+       public void setActive(boolean active) {
+               this.active = active;
+       }
+       @View
+       @Order(7)       
+       public boolean isAdmin() {
+               return admin;
+       }
+       public void setAdmin(boolean admin) {
+               this.admin = admin;
+       }
+       
+       
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/AdminOnlyToAdmins.aj
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/AdminOnlyToAdmins.aj?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/AdminOnlyToAdmins.aj
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/AdminOnlyToAdmins.aj
 Tue Jul 21 01:42:01 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.magma.web.user;
 import org.apache.magma.domain.user.User;
 import org.apache.magma.website.admin.AdminWebHandler;

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallAdminCruds.aj
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallAdminCruds.aj?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallAdminCruds.aj
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallAdminCruds.aj
 Tue Jul 21 01:42:01 2009
@@ -1,13 +1,29 @@
-package org.apache.magma.web.user;
-
-
-import org.apache.magma.domain.user.User;
-import org.apache.magma.website.admin.Manages;
-import org.apache.magma.website.admin.AdminWebHandler;
-
-public aspect InstallAdminCruds {
-       @Manages(User.class)
-       public UserCrud AdminWebHandler.handleUser() {
-               return new UserCrud();
-       }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+
+import org.apache.magma.domain.user.User;
+import org.apache.magma.website.admin.Manages;
+import org.apache.magma.website.admin.AdminWebHandler;
+
+public aspect InstallAdminCruds {
+       @Manages(User.class)
+       public UserCrud AdminWebHandler.handleUser() {
+               return new UserCrud();
+       }
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallUserHandlerIntoRoot.aj
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallUserHandlerIntoRoot.aj?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallUserHandlerIntoRoot.aj
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/InstallUserHandlerIntoRoot.aj
 Tue Jul 21 01:42:01 2009
@@ -1,27 +1,43 @@
-package org.apache.magma.web.user;
-
-import org.apache.magma.website.RootWebHandler;
-import org.apache.magma.website.templating.DefaultTemplate;
-import org.apache.magma.website.templating.Template;
-
-public privileged aspect InstallUserHandlerIntoRoot {
-       
-       public LoginWebHandler RootWebHandler.handleLogin() {
-               return new LoginWebHandler();
-       }
-       
-       public UserWebHandler RootWebHandler.handleUser() {
-               return new UserWebHandler();
-       }
-       
-       public SettingsWebHandler RootWebHandler.handleSettings() {
-               return new SettingsWebHandler();
-       }
-       
-       /**
-        * Adds a box in the right zone of the default template
-        */
-       after(Template tpl) : execution(* DefaultTemplate.layoutRight()) && 
this(tpl)  && within(DefaultTemplate) {
-               
tpl.byDefault(LoginWebHandler.class,(tpl.root().handleLogin().doLoginBox()));
-       }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+import org.apache.magma.website.RootWebHandler;
+import org.apache.magma.website.templating.DefaultTemplate;
+import org.apache.magma.website.templating.Template;
+
+public privileged aspect InstallUserHandlerIntoRoot {
+       
+       public LoginWebHandler RootWebHandler.handleLogin() {
+               return new LoginWebHandler();
+       }
+       
+       public UserWebHandler RootWebHandler.handleUser() {
+               return new UserWebHandler();
+       }
+       
+       public SettingsWebHandler RootWebHandler.handleSettings() {
+               return new SettingsWebHandler();
+       }
+       
+       /**
+        * Adds a box in the right zone of the default template
+        */
+       after(Template tpl) : execution(* DefaultTemplate.layoutRight()) && 
this(tpl)  && within(DefaultTemplate) {
+               
tpl.byDefault(LoginWebHandler.class,(tpl.root().handleLogin().doLoginBox()));
+       }
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginRequest.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginRequest.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginRequest.java
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginRequest.java
 Tue Jul 21 01:42:01 2009
@@ -1,47 +1,63 @@
-package org.apache.magma.web.user;
-
-
-import org.apache.magma.beans.MagmaBean;
-import org.apache.magma.validation.validators.Email;
-import org.apache.magma.validation.validators.Required;
-import org.apache.magma.view.Order;
-import org.apache.magma.view.View;
-
-...@magmabean
-public class LoginRequest {
-       private String email;
-       private String password;
-       private boolean rememberme;
-       
-       
-       @View
-       @Order(1)
-       @Required
-       @Email
-       public String getEmail() {
-               return email;
-       }
-       public void setEmail(String email) {
-               this.email = email;
-       }
-       
-       @View(password=true)
-       @Order(2)
-       @Required
-       public String getPassword() {
-               return password;
-       }
-       public void setPassword(String password) {
-               this.password = password;
-       }
-       
-
-       @View
-       @Order(3)
-       public boolean isRememberme() {
-               return rememberme;
-       }
-       public void setRememberme(boolean rememberme) {
-               this.rememberme = rememberme;
-       }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+
+import org.apache.magma.beans.MagmaBean;
+import org.apache.magma.validation.validators.Email;
+import org.apache.magma.validation.validators.Required;
+import org.apache.magma.view.Order;
+import org.apache.magma.view.View;
+
+...@magmabean
+public class LoginRequest {
+       private String email;
+       private String password;
+       private boolean rememberme;
+       
+       
+       @View
+       @Order(1)
+       @Required
+       @Email
+       public String getEmail() {
+               return email;
+       }
+       public void setEmail(String email) {
+               this.email = email;
+       }
+       
+       @View(password=true)
+       @Order(2)
+       @Required
+       public String getPassword() {
+               return password;
+       }
+       public void setPassword(String password) {
+               this.password = password;
+       }
+       
+
+       @View
+       @Order(3)
+       public boolean isRememberme() {
+               return rememberme;
+       }
+       public void setRememberme(boolean rememberme) {
+               this.rememberme = rememberme;
+       }
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginWebHandler.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginWebHandler.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginWebHandler.java
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/LoginWebHandler.java
 Tue Jul 21 01:42:01 2009
@@ -1,113 +1,129 @@
-package org.apache.magma.web.user;
-
-import java.util.List;
-
-import org.apache.magma.database.Database;
-import org.apache.magma.domain.user.User;
-import org.apache.magma.email.Email;
-import org.apache.magma.website.CompoundType;
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.WebHandler;
-import org.apache.magma.website.beansview.ShowBean;
-import org.apache.magma.website.beansview.SmartForm;
-import org.apache.magma.website.producers.TemplatingProducer;
-
-
-public class LoginWebHandler extends WebHandler{
-       private User sessionUser;
-       private User cookieUser;
-       private String cookiePassword;
-       
-               public HtmlProducer doLoginBox() {
-                       if (this.cookiePassword != null && this.cookieUser != 
null){
-                               if 
(this.cookiePassword.equals(this.cookieUser.getPassword())) {
-                                       this.sessionUser = this.cookieUser;
-                               }
-                       }
-                       if (this.sessionUser == null) {                         
-                               return handleRequest().doShow();
-                       } else {
-                               if(this.sessionUser.isActive()){
-                                       return new 
TemplatingProducer("loginMenu").addParameter(this.sessionUser);
-                               } else {                                        
-                                       return doInactive();
-                               }                                               
        
-                       }
-               }
-               
-               public HtmlProducer doSmallLogin(){
-                       if (this.cookiePassword != null && this.cookieUser != 
null){
-                               if 
(this.cookiePassword.equals(this.cookieUser.getPassword())) {
-                                       this.sessionUser = this.cookieUser;
-                               }
-                       }
-                       if (this.sessionUser == null) {                         
-                               return new TemplatingProducer("smallLogin");
-                       } else {
-                               if(this.sessionUser.isActive()){
-                                       return new 
TemplatingProducer("smallLoginMenu").addParameter(this.sessionUser);
-                               } else {                                        
-                                       return doInactive();
-                               }                                               
        
-                       }
-               }
-               
-               public SmartForm handleResendPassword(){
-                       PasswordRequest pr = new PasswordRequest();
-                       return new SmartForm(pr, "hiddenSendPassword");
-               }
-               
-               public HtmlProducer hiddenSendPassword(PasswordRequest pr){
-                       List<User> list = new Database().query(User.class, 
"WHERE x.email=?1", pr.getEmail());
-                       if(list.size()!= 0){
-                               User user = list.get(0);
-                               HtmlProducer mailprod = new 
TemplatingProducer("password").addParameter("user",user);
-                               mailprod.compoundWith(new ShowBean(user), 
CompoundType.AFTER);
-                               Email mail = new Email();
-                               mail.to(user.getEmail());
-                               mail.subject("Forgot Password?");
-                               mail.html(mailprod);
-                               mail.send();
-                               return new TemplatingProducer("pwsent");
-                       } else {
-                               return new TemplatingProducer("nouser");
-                       }
-               }
-               
-               public SmartForm handleRequest(){
-                       LoginRequest r = new LoginRequest();
-
-                       return new SmartForm(r, "hiddenLogin", new 
TemplatingProducer("loginBox"));
-               }
-               public HtmlProducer hiddenLogin(LoginRequest r) {
-                   List<User> list = new Database().query(User.class, "WHERE 
x.email=?1 and x.password=?2", r.getEmail(), r.getPassword());
-                   if(list.size()!= 0){
-                           this.sessionUser = list.get(0);             
-                               if(r.isRememberme()){
-                                       this.cookieUser = sessionUser;
-                                       this.cookiePassword = 
sessionUser.getPassword();
-                               }
-                               return doLoginBox();
-                   }else{
-                       return doLoginError();
-                   }
-                   
-               }
-               
-               public HtmlProducer doLoginError(){
-                       return new TemplatingProducer("loginerror");
-               }
-               
-               public HtmlProducer doLogout(){
-                       this.cookieUser = null;
-                       this.cookiePassword = null;
-                       this.sessionUser = null;
-                       return doLoginBox();
-               }
-               public HtmlProducer doInactive(){
-                       this.cookieUser = null;
-                       this.cookiePassword = null;
-                       this.sessionUser = null;
-                       return new TemplatingProducer("notactive"); 
-               }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+import java.util.List;
+
+import org.apache.magma.database.Database;
+import org.apache.magma.domain.user.User;
+import org.apache.magma.email.Email;
+import org.apache.magma.website.CompoundType;
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.WebHandler;
+import org.apache.magma.website.beansview.ShowBean;
+import org.apache.magma.website.beansview.SmartForm;
+import org.apache.magma.website.producers.TemplatingProducer;
+
+
+public class LoginWebHandler extends WebHandler{
+       private User sessionUser;
+       private User cookieUser;
+       private String cookiePassword;
+       
+               public HtmlProducer doLoginBox() {
+                       if (this.cookiePassword != null && this.cookieUser != 
null){
+                               if 
(this.cookiePassword.equals(this.cookieUser.getPassword())) {
+                                       this.sessionUser = this.cookieUser;
+                               }
+                       }
+                       if (this.sessionUser == null) {                         
+                               return handleRequest().doShow();
+                       } else {
+                               if(this.sessionUser.isActive()){
+                                       return new 
TemplatingProducer("loginMenu").addParameter(this.sessionUser);
+                               } else {                                        
+                                       return doInactive();
+                               }                                               
        
+                       }
+               }
+               
+               public HtmlProducer doSmallLogin(){
+                       if (this.cookiePassword != null && this.cookieUser != 
null){
+                               if 
(this.cookiePassword.equals(this.cookieUser.getPassword())) {
+                                       this.sessionUser = this.cookieUser;
+                               }
+                       }
+                       if (this.sessionUser == null) {                         
+                               return new TemplatingProducer("smallLogin");
+                       } else {
+                               if(this.sessionUser.isActive()){
+                                       return new 
TemplatingProducer("smallLoginMenu").addParameter(this.sessionUser);
+                               } else {                                        
+                                       return doInactive();
+                               }                                               
        
+                       }
+               }
+               
+               public SmartForm handleResendPassword(){
+                       PasswordRequest pr = new PasswordRequest();
+                       return new SmartForm(pr, "hiddenSendPassword");
+               }
+               
+               public HtmlProducer hiddenSendPassword(PasswordRequest pr){
+                       List<User> list = new Database().query(User.class, 
"WHERE x.email=?1", pr.getEmail());
+                       if(list.size()!= 0){
+                               User user = list.get(0);
+                               HtmlProducer mailprod = new 
TemplatingProducer("password").addParameter("user",user);
+                               mailprod.compoundWith(new ShowBean(user), 
CompoundType.AFTER);
+                               Email mail = new Email();
+                               mail.to(user.getEmail());
+                               mail.subject("Forgot Password?");
+                               mail.html(mailprod);
+                               mail.send();
+                               return new TemplatingProducer("pwsent");
+                       } else {
+                               return new TemplatingProducer("nouser");
+                       }
+               }
+               
+               public SmartForm handleRequest(){
+                       LoginRequest r = new LoginRequest();
+
+                       return new SmartForm(r, "hiddenLogin", new 
TemplatingProducer("loginBox"));
+               }
+               public HtmlProducer hiddenLogin(LoginRequest r) {
+                   List<User> list = new Database().query(User.class, "WHERE 
x.email=?1 and x.password=?2", r.getEmail(), r.getPassword());
+                   if(list.size()!= 0){
+                           this.sessionUser = list.get(0);             
+                               if(r.isRememberme()){
+                                       this.cookieUser = sessionUser;
+                                       this.cookiePassword = 
sessionUser.getPassword();
+                               }
+                               return doLoginBox();
+                   }else{
+                       return doLoginError();
+                   }
+                   
+               }
+               
+               public HtmlProducer doLoginError(){
+                       return new TemplatingProducer("loginerror");
+               }
+               
+               public HtmlProducer doLogout(){
+                       this.cookieUser = null;
+                       this.cookiePassword = null;
+                       this.sessionUser = null;
+                       return doLoginBox();
+               }
+               public HtmlProducer doInactive(){
+                       this.cookieUser = null;
+                       this.cookiePassword = null;
+                       this.sessionUser = null;
+                       return new TemplatingProducer("notactive"); 
+               }
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/PasswordRequest.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/PasswordRequest.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/PasswordRequest.java
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/PasswordRequest.java
 Tue Jul 21 01:42:01 2009
@@ -1,24 +1,40 @@
-package org.apache.magma.web.user;
-
-import javax.persistence.Entity;
-
-import org.apache.magma.beans.MagmaBean;
-import org.apache.magma.validation.validators.Required;
-import org.apache.magma.view.Order;
-import org.apache.magma.view.View;
-
-...@magmabean
-public class PasswordRequest {
-       private String email;
-
-       @View
-       @Order(1)
-       @Required
-       public String getEmail() {
-               return email;
-       }
-       public void setEmail(String email) {
-               this.email = email;
-       }
-       
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+import javax.persistence.Entity;
+
+import org.apache.magma.beans.MagmaBean;
+import org.apache.magma.validation.validators.Required;
+import org.apache.magma.view.Order;
+import org.apache.magma.view.View;
+
+...@magmabean
+public class PasswordRequest {
+       private String email;
+
+       @View
+       @Order(1)
+       @Required
+       public String getEmail() {
+               return email;
+       }
+       public void setEmail(String email) {
+               this.email = email;
+       }
+       
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/SettingsWebHandler.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/SettingsWebHandler.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/SettingsWebHandler.java
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/SettingsWebHandler.java
 Tue Jul 21 01:42:01 2009
@@ -1,16 +1,32 @@
-package org.apache.magma.web.user;
-
-
-
-import org.apache.magma.domain.user.User;
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.WebHandler;
-import org.apache.magma.website.producers.TemplatingProducer;
-
-public class SettingsWebHandler extends WebHandler{
-       private User sessionUser;
-
-       public HtmlProducer doSettings(){
-               return new 
TemplatingProducer("settings").addParameter(this.sessionUser);
-       }                               
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+
+
+import org.apache.magma.domain.user.User;
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.WebHandler;
+import org.apache.magma.website.producers.TemplatingProducer;
+
+public class SettingsWebHandler extends WebHandler{
+       private User sessionUser;
+
+       public HtmlProducer doSettings(){
+               return new 
TemplatingProducer("settings").addParameter(this.sessionUser);
+       }                               
+}

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserCrud.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserCrud.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserCrud.java
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserCrud.java
 Tue Jul 21 01:42:01 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.magma.web.user;
 
 import org.apache.magma.website.HtmlProducer;

Modified: 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java?rev=796111&r1=796110&r2=796111&view=diff
==============================================================================
--- 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java
 (original)
+++ 
labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java
 Tue Jul 21 01:42:01 2009
@@ -1,112 +1,128 @@
-package org.apache.magma.web.user;
-
-import org.apache.magma.domain.user.User;
-
-import java.util.List;
-
-import org.apache.magma.database.Database;
-import org.apache.magma.email.Email;
-import org.apache.magma.view.tree.SimpleViewFilter;
-import org.apache.magma.view.tree.ViewCustomizer;
-import org.apache.magma.website.CompoundType;
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.WebHandler;
-import org.apache.magma.website.beansview.ShowBean;
-import org.apache.magma.website.beansview.ShowList;
-import org.apache.magma.website.beansview.SmartForm;
-import org.apache.magma.website.producers.StringHtmlProducer;
-import org.apache.magma.website.producers.TemplatingProducer;
-import org.apache.magma.website.velocity.VelocityHtmlProducer;
-
-public class UserWebHandler extends WebHandler{
-       protected ViewCustomizer register = new 
SimpleViewFilter("-admin","-active");
-       protected ViewCustomizer showRegister = new 
SimpleViewFilter("-admin","-confirmPassword");
-       protected ViewCustomizer listCustomizer = null;
-       protected ViewCustomizer showCustomizer = new 
SimpleViewFilter("-admin","-active", "-confirmPassword");
-       protected ViewCustomizer editCustomizer = null;
-       protected ViewCustomizer edit = new 
SimpleViewFilter("-active","-admin","-name","-surname");
-       
-       private User sessionUser;
-
-       public SmartForm handleNewUser() {
-               User user = new User();
-               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("New User");
-               return new SmartForm(user, "hiddenRegister", 
header).setFilter(register);
-       }
-       
-       public HtmlProducer hiddenRegister(User user) {
-               // TODO move this check in a validator or something
-               if (!user.getPassword().equals(user.getConfirmPassword())) {
-                       StringHtmlProducer passwordError = new 
StringHtmlProducer("wrong password");
-                       passwordError.compoundWith(handleNewUser().doShow(), 
CompoundType.AFTER);
-                       return passwordError;
-               }
-               new Database().save(user);
-               try {
-                       HtmlProducer mailprod = new 
TemplatingProducer("/org/apache/magma/web/user/activation").addParameter("user",user);
-                       mailprod.compoundWith(new ShowBean(user), 
CompoundType.AFTER);  
-                       Email mail = new Email();
-                       mail.to(user.getEmail());
-                       mail.subject("Account Activation");
-                       mail.html(mailprod);
-                       mail.send();
-               } catch (Exception e) {
-                       e.printStackTrace();
-                       StringHtmlProducer error = new 
StringHtmlProducer("Error sending email");
-                       error.compoundWith(handleNewUser().doShow(), 
CompoundType.AFTER);
-                       return error; 
-               }
-               return doRegistered(user);
-       }
-       
-       public HtmlProducer doRegistered(User user) {
-               return (HtmlProducer) doShow(user).compoundWith(new 
TemplatingProducer("registered").addParameter("user", user), 
CompoundType.BEFORE);
-       }
-
-       public HtmlProducer doActivate(User user) {
-               if (user != null) {
-                       user.setActive(true);
-                       new Database().save(user);
-                       return new 
TemplatingProducer("activated").addParameter("user", user);
-               } else {
-                       return new TemplatingProducer("noUserFound");
-               }
-       }
-       
-       
-       
-       public HtmlProducer doShow(User user) {
-               ShowBean showBean = new ShowBean(user, showCustomizer);
-               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("Info " + user.getName()+ " " + 
user.getSurname());
-               showBean.compoundWith(header, CompoundType.BEFORE);
-               return showBean;
-       }
-       
-       public HtmlProducer doList() {
-               List<User> query = new Database().query(User.class, "");
-               ShowList showList = new ShowList(User.class, query, 
listCustomizer, "doShow");
-               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("Users List");
-               showList.compoundWith(header, CompoundType.BEFORE);
-               return showList;
-       }
-       
-       public SmartForm handleEditProfile(){
-               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("Edit Profile Settings");
-               return new SmartForm(sessionUser, "hiddenEdit", 
header).setFilter(edit);
-       }
-       
-       public HtmlProducer hiddenEdit(User user) {
-               new Database().save(user);
-               try {
-                       HtmlProducer mailprod = new 
VelocityHtmlProducer("edit").addParameter("user",user);
-                       mailprod.compoundWith(new ShowBean(user), 
CompoundType.AFTER);  
-                       Email mail = new Email();
-                       mail.to(user.getEmail());
-                       mail.subject("Edit User Info");
-                       mail.html(mailprod);
-                       mail.send();
-               } catch (Exception e) {
-               }
-               return doShow(user);
-       }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.web.user;
+
+import org.apache.magma.domain.user.User;
+
+import java.util.List;
+
+import org.apache.magma.database.Database;
+import org.apache.magma.email.Email;
+import org.apache.magma.view.tree.SimpleViewFilter;
+import org.apache.magma.view.tree.ViewCustomizer;
+import org.apache.magma.website.CompoundType;
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.WebHandler;
+import org.apache.magma.website.beansview.ShowBean;
+import org.apache.magma.website.beansview.ShowList;
+import org.apache.magma.website.beansview.SmartForm;
+import org.apache.magma.website.producers.StringHtmlProducer;
+import org.apache.magma.website.producers.TemplatingProducer;
+import org.apache.magma.website.velocity.VelocityHtmlProducer;
+
+public class UserWebHandler extends WebHandler{
+       protected ViewCustomizer register = new 
SimpleViewFilter("-admin","-active");
+       protected ViewCustomizer showRegister = new 
SimpleViewFilter("-admin","-confirmPassword");
+       protected ViewCustomizer listCustomizer = null;
+       protected ViewCustomizer showCustomizer = new 
SimpleViewFilter("-admin","-active", "-confirmPassword");
+       protected ViewCustomizer editCustomizer = null;
+       protected ViewCustomizer edit = new 
SimpleViewFilter("-active","-admin","-name","-surname");
+       
+       private User sessionUser;
+
+       public SmartForm handleNewUser() {
+               User user = new User();
+               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("New User");
+               return new SmartForm(user, "hiddenRegister", 
header).setFilter(register);
+       }
+       
+       public HtmlProducer hiddenRegister(User user) {
+               // TODO move this check in a validator or something
+               if (!user.getPassword().equals(user.getConfirmPassword())) {
+                       StringHtmlProducer passwordError = new 
StringHtmlProducer("wrong password");
+                       passwordError.compoundWith(handleNewUser().doShow(), 
CompoundType.AFTER);
+                       return passwordError;
+               }
+               new Database().save(user);
+               try {
+                       HtmlProducer mailprod = new 
TemplatingProducer("/org/apache/magma/web/user/activation").addParameter("user",user);
+                       mailprod.compoundWith(new ShowBean(user), 
CompoundType.AFTER);  
+                       Email mail = new Email();
+                       mail.to(user.getEmail());
+                       mail.subject("Account Activation");
+                       mail.html(mailprod);
+                       mail.send();
+               } catch (Exception e) {
+                       e.printStackTrace();
+                       StringHtmlProducer error = new 
StringHtmlProducer("Error sending email");
+                       error.compoundWith(handleNewUser().doShow(), 
CompoundType.AFTER);
+                       return error; 
+               }
+               return doRegistered(user);
+       }
+       
+       public HtmlProducer doRegistered(User user) {
+               return (HtmlProducer) doShow(user).compoundWith(new 
TemplatingProducer("registered").addParameter("user", user), 
CompoundType.BEFORE);
+       }
+
+       public HtmlProducer doActivate(User user) {
+               if (user != null) {
+                       user.setActive(true);
+                       new Database().save(user);
+                       return new 
TemplatingProducer("activated").addParameter("user", user);
+               } else {
+                       return new TemplatingProducer("noUserFound");
+               }
+       }
+       
+       
+       
+       public HtmlProducer doShow(User user) {
+               ShowBean showBean = new ShowBean(user, showCustomizer);
+               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("Info " + user.getName()+ " " + 
user.getSurname());
+               showBean.compoundWith(header, CompoundType.BEFORE);
+               return showBean;
+       }
+       
+       public HtmlProducer doList() {
+               List<User> query = new Database().query(User.class, "");
+               ShowList showList = new ShowList(User.class, query, 
listCustomizer, "doShow");
+               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("Users List");
+               showList.compoundWith(header, CompoundType.BEFORE);
+               return showList;
+       }
+       
+       public SmartForm handleEditProfile(){
+               HtmlProducer header = new 
VelocityHtmlProducer("listHeader").addParameter("Edit Profile Settings");
+               return new SmartForm(sessionUser, "hiddenEdit", 
header).setFilter(edit);
+       }
+       
+       public HtmlProducer hiddenEdit(User user) {
+               new Database().save(user);
+               try {
+                       HtmlProducer mailprod = new 
VelocityHtmlProducer("edit").addParameter("user",user);
+                       mailprod.compoundWith(new ShowBean(user), 
CompoundType.AFTER);  
+                       Email mail = new Email();
+                       mail.to(user.getEmail());
+                       mail.subject("Edit User Info");
+                       mail.html(mailprod);
+                       mail.send();
+               } catch (Exception e) {
+               }
+               return doShow(user);
+       }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to