Author: massi
Date: Tue Jan 29 13:50:27 2013
New Revision: 1439892

URL: http://svn.apache.org/viewvc?rev=1439892&view=rev
Log:
editModalPage linked, directly, to username

Modified:
    
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java
    
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html
    
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.properties
    
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage_it.properties

Modified: 
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java?rev=1439892&r1=1439891&r2=1439892&view=diff
==============================================================================
--- 
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java
 (original)
+++ 
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java
 Tue Jan 29 13:50:27 2013
@@ -22,22 +22,17 @@ import org.apache.syncope.common.to.User
 import org.apache.syncope.console.SyncopeApplication;
 import org.apache.syncope.console.SyncopeSession;
 import org.apache.syncope.console.rest.UserRestClient;
-import org.apache.syncope.console.wicket.markup.html.form.LinkPanel;
 import org.apache.wicket.Component;
 import org.apache.wicket.Page;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.IAjaxIndicatorAware;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.spring.injection.annot.SpringBean;
 
@@ -110,43 +105,37 @@ public class BasePage extends AbstractBa
         editProfileModalWin.setCookieName("edit-profile-modal");
         add(editProfileModalWin);
 
-        add(new Label("username", SyncopeSession.get().getUserId()));
+        final AjaxLink editProfileLink = new AjaxLink("editProfileLink") {
 
-        Fragment editProfileFrag;
-        if ("admin".equals(SyncopeSession.get().getUserId())) {
-            editProfileFrag = new Fragment("editProfile", "adminEmptyFrag", 
this);
-        } else {
-            final UserTO userTO = SyncopeSession.get().isAuthenticated()
-                    ? userRestClient.readProfile()
-                    : new UserTO();
-
-            editProfileFrag = new Fragment("editProfile", "editProfileFrag", 
this);
+            private static final long serialVersionUID = -7978723352517770644L;
 
-            final AjaxLink editProfileLink = new IndicatingAjaxLink("link") {
+            @Override
+            public void onClick(AjaxRequestTarget target) {
+                final UserTO userTO = SyncopeSession.get().isAuthenticated()
+                        ? userRestClient.readProfile()
+                        : new UserTO();
 
-                private static final long serialVersionUID = 
-7978723352517770644L;
+                editProfileModalWin.setPageCreator(new 
ModalWindow.PageCreator() {
+                    private static final long serialVersionUID = 
-7834632442532690940L;
 
-                @Override
-                public void onClick(final AjaxRequestTarget target) {
-                    editProfileModalWin.setPageCreator(new 
ModalWindow.PageCreator() {
+                    @Override
+                    public Page createPage() {
+                        return new 
UserRequestModalPage(BasePage.this.getPageReference(), editProfileModalWin,
+                                userTO, UserModalPage.Mode.SELF);
+                    }
+                });
 
-                        @Override
-                        public Page createPage() {
-                            return new 
UserRequestModalPage(BasePage.this.getPageReference(), editProfileModalWin,
-                                    userTO, UserModalPage.Mode.SELF);
-                        }
-                    });
+                editProfileModalWin.show(target);
+            }
+        };
 
-                    editProfileModalWin.show(target);
-                }
-            };
-            editProfileLink.add(new Label("linkTitle", 
getString("editProfile")));
+        editProfileLink.add(new Label("username", 
SyncopeSession.get().getUserId()));
 
-            Panel panel = new LinkPanel("editProfile", new 
ResourceModel("editProfile"));
-            panel.add(editProfileLink);
-            editProfileFrag.add(panel);
+        if ("admin".equals(SyncopeSession.get().getUserId())) {
+            editProfileLink.setEnabled(false);
         }
-        add(editProfileFrag);
+
+        add(editProfileLink);
     }
 
     @Override

Modified: 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html
URL: 
http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html?rev=1439892&r1=1439891&r2=1439892&view=diff
==============================================================================
--- 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html
 (original)
+++ 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html
 Tue Jan 29 13:50:27 2013
@@ -122,15 +122,9 @@ under the License.
         <li style="float:right;width:auto;text-align:right;">
           <a href="#" wicket:id="logout"><img src="img/menu/logout.png" 
alt="Logout" width="80" height="80" /><br /></a>
           <div style="display: table-row;">
-            <div id="username" wicket:id="username" style="padding-right: 
5px;width: 100px;cursor: pointer;display: table-cell;"/>
-            <span wicket:id="editProfile"/>
-
-            <wicket:fragment wicket:id="adminEmptyFrag"/>
-            <wicket:fragment wicket:id="editProfileFrag">
-              <br/>
-              <span id="editProfile" wicket:id="editProfile" 
-                    style="cursor: pointer;background-color: 
#446633;padding-left: 9px;padding-right: 9px;"/>
-            </wicket:fragment>
+            <div id="username" style="padding-right: 5px;width: 100px;cursor: 
pointer;display: table-cell;">
+              <a href="#" wicket:id="editProfileLink"><span 
wicket:id="username"/></a>
+            </div>
             <div>
               <div wicket:id="infoModal"/>
               <a wicket:id="infoLink" style="vertical-align: middle;"><img 
src="img/info.png" alt="info" style="padding-right: 10px;"/></a>

Modified: 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.properties
URL: 
http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.properties?rev=1439892&r1=1439891&r2=1439892&view=diff
==============================================================================
--- 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.properties
 (original)
+++ 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.properties
 Tue Jan 29 13:50:27 2013
@@ -16,5 +16,4 @@
 # under the License.
 displayRows=Rows to display:
 home=Home
-editProfile=Edit profile
 version=VERSION

Modified: 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage_it.properties
URL: 
http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage_it.properties?rev=1439892&r1=1439891&r2=1439892&view=diff
==============================================================================
--- 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage_it.properties
 (original)
+++ 
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage_it.properties
 Tue Jan 29 13:50:27 2013
@@ -16,5 +16,4 @@
 # under the License.
 displayRows=Righe per pagina:
 home=Home
-editProfile=Modifica profile
 version=VERSIONE


Reply via email to