Changeset 4026

Show
Ignore:
Timestamp:
01/27/10 12:20:28 (2 years ago)
Author:
mszopinski
Message:

user <-> group interaction

Location:
ssme/trunk
Files:
3 added
21 modified

Legend:

Unmodified
Added
Removed
  • ssme/trunk/src/com/kh/ssme/business/GroupService.java

    r4018 r4026  
    2828import com.kh.ssme.manage.GroupManager; 
    2929import com.kh.ssme.manage.PersistenceManager; 
     30import com.kh.ssme.manage.UserManager; 
    3031import com.kh.ssme.model.entity.GroupEntity; 
    3132import com.kh.ssme.model.ifc.Group; 
     33import com.kh.ssme.model.ifc.User; 
    3234import com.kh.ssme.rest.parsers.EntityParserTools; 
    3335 
     
    4042        private static final Logger logger_ = LoggerFactory.getLogger(GroupService.class); 
    4143         
    42         public static Group create(Object o){ 
     44        public static Group create(Object json){ 
    4345                PersistenceManager.getInstance().beginTransaction(); 
    4446                try{ 
    4547                        Group group = new GroupEntity(); 
    46                         EntityParserTools.getMerger(o).parseAndMerge(o, group);                  
     48                        EntityParserTools.getMerger(json).parseAndMerge(json, group);                    
    4749                        GroupManager.createGroup(group); 
     50                        UserManager.addToOwnedGroups(group.getOwner(), group); 
    4851                        PersistenceManager.getInstance().commitTransaction(); 
    4952                        return group; 
     
    5558        } 
    5659         
    57         public static Group update(String uuid, Object o){ 
     60        public static Group update(String uuid, Object json){ 
    5861                PersistenceManager.getInstance().beginTransaction(); 
    5962                try{ 
    6063                        Group group = GroupManager.findGroupByUUID(uuid); 
    61                         EntityParserTools.getMerger(o).parseAndMerge(o, group); 
     64                        EntityParserTools.getMerger(json).parseAndMerge(json, group); 
    6265                        PersistenceManager.getInstance().commitTransaction(); 
    6366                        return group; 
  • ssme/trunk/src/com/kh/ssme/business/UserService.java

    r4018 r4026  
    2626import org.slf4j.LoggerFactory; 
    2727 
     28import com.kh.ssme.manage.GroupManager; 
    2829import com.kh.ssme.manage.PersistenceManager; 
    2930import com.kh.ssme.manage.UserManager; 
     
    9293        }        
    9394         
     95         
    9496} 
  • ssme/trunk/src/com/kh/ssme/manage/GroupManager.java

    r4020 r4026  
    3030import com.kh.ssme.model.entity.GroupEntity; 
    3131import com.kh.ssme.model.ifc.Group; 
     32import com.kh.ssme.model.ifc.User; 
    3233 
    3334/** 
     
    105106                return null; 
    106107        }                
     108         
     109        /** 
     110         * Adds user to group 
     111         * @param group 
     112         * @param user 
     113         */ 
     114        public static void joinUserToGroup(Group group, User user) { 
     115                logger_.debug("User "+user+" added to group "+group);    
     116                if(!group.getUsers().contains(user)){ 
     117                        group.getUsers().add(user); 
     118                        PersistenceManager.getInstance().persistEntity(group);                   
     119                } 
     120        }                
     121         
    107122} 
  • ssme/trunk/src/com/kh/ssme/manage/UserManager.java

    r4020 r4026  
    2929 
    3030import com.kh.ssme.model.entity.UserEntity; 
     31import com.kh.ssme.model.ifc.Group; 
    3132import com.kh.ssme.model.ifc.User; 
    3233 
     
    104105                } 
    105106                return null; 
     107        } 
     108 
     109        /** 
     110         * Adds given group to users owned groups 
     111         * @param owner 
     112         * @param group 
     113         */ 
     114        public static void addToOwnedGroups(User owner, Group group) { 
     115                logger_.debug("Group "+group+" added to user "+owner+" owned groups ");  
     116                if(!owner.getOwnedGroups().contains(group)){ 
     117                        owner.getOwnedGroups().add(group); 
     118                        PersistenceManager.getInstance().persistEntity(owner); 
     119                } 
    106120        }                
    107121         
  • ssme/trunk/src/com/kh/ssme/model/entity/BasicDataEntity.java

    r4020 r4026  
    3838 
    3939/** 
    40  * @author Michal Szopinski 
    41  * @param <T> 
    4240 * 
    4341 */ 
  • ssme/trunk/src/com/kh/ssme/model/entity/GroupEntity.java

    r4022 r4026  
    2323package com.kh.ssme.model.entity; 
    2424 
    25 import java.util.Set; 
    26 import java.util.TreeSet; 
     25import java.util.ArrayList; 
     26import java.util.List; 
    2727 
    2828import javax.persistence.Basic; 
     
    6464                        joinColumns=@JoinColumn(name="ugroup__id", referencedColumnName="id"), 
    6565                        inverseJoinColumns=@JoinColumn(name="user__id", referencedColumnName="id")) 
    66         private Set<User> users_ = new TreeSet<User>(); 
     66        private List<User> users_ = new ArrayList<User>(); 
    6767         
    6868        @ManyToOne(optional=false, targetEntity=UserEntity.class) 
    69         @JoinColumn(name="user_id", nullable=false, updatable=false)     
     69        @JoinColumn(name="owner_user_id", nullable=false, updatable=false)       
    7070        private User owner_;     
    7171         
     
    125125         */ 
    126126        @Override 
    127         public Set<User> getUsers() { 
     127        public List<User> getUsers() { 
    128128                return users_; 
    129129        } 
    130130 
    131131        /* (non-Javadoc) 
    132          * @see com.kh.ssme.model.ifc.Group#setUsers(java.util.Set) 
     132         * @see com.kh.ssme.model.ifc.Group#setUsers(java.util.List) 
    133133         */ 
    134134        @Override 
    135         public void setUsers(Set<User> users) { 
     135        public void setUsers(List<User> users) { 
    136136                users_ = users; 
    137137        } 
  • ssme/trunk/src/com/kh/ssme/model/entity/UserEntity.java

    r4022 r4026  
    2323package com.kh.ssme.model.entity; 
    2424 
    25 import java.util.Set; 
    26 import java.util.TreeSet; 
     25import java.util.ArrayList; 
     26import java.util.List; 
    2727 
    2828import javax.persistence.Basic; 
     
    7373  
    7474        @ManyToMany(targetEntity=GroupEntity.class, mappedBy="users_", cascade=CascadeType.ALL) 
    75         private Set<Group> groups_ = new TreeSet<Group>(); 
     75        private List<Group> groups_ = new ArrayList<Group>(); 
    7676         
    7777        @OneToMany(targetEntity=StayPlaceEntity.class, cascade=CascadeType.ALL, mappedBy="user_") 
    78         private Set<StayPlace> stayPlaces_ = new TreeSet<StayPlace>(); 
     78        private List<StayPlace> stayPlaces_ = new ArrayList<StayPlace>(); 
    7979         
    8080        @OneToMany(targetEntity=CalendarEntity.class, cascade=CascadeType.ALL, mappedBy="user_") 
    81         private Set<com.kh.ssme.model.ifc.Calendar> calendars_ = new TreeSet<com.kh.ssme.model.ifc.Calendar>(); 
     81        private List<com.kh.ssme.model.ifc.Calendar> calendars_ = new ArrayList<com.kh.ssme.model.ifc.Calendar>(); 
    8282         
    8383        @OneToMany(targetEntity=GroupEntity.class, cascade=CascadeType.ALL, mappedBy="owner_") 
    84         private Set<Group> ownedGroups_ = new TreeSet<Group>(); 
     84        private List<Group> ownedGroups_ = new ArrayList<Group>(); 
    8585         
    8686         
     
    188188 
    189189        @Override 
    190         public Set<Group> getGroups() {          
     190        public List<Group> getGroups() {                 
    191191                return groups_; 
    192192        } 
    193193 
    194194        @Override 
    195         public void setGroups(Set<Group> groups) { 
     195        public void setGroups(List<Group> groups) { 
    196196                groups_ = groups;                
    197197        } 
     
    201201         */ 
    202202        @Override 
    203         public Set<StayPlace> getStayPlaces() { 
     203        public List<StayPlace> getStayPlaces() { 
    204204                return stayPlaces_; 
    205205        } 
    206206 
    207207        /* (non-Javadoc) 
    208          * @see com.kh.ssme.model.ifc.User#setStayPlaces(java.util.Set) 
    209          */ 
    210         @Override 
    211         public void setStayPlaces(Set<StayPlace> stayPlaces) { 
     208         * @see com.kh.ssme.model.ifc.User#setStayPlaces(java.util.List) 
     209         */ 
     210        @Override 
     211        public void setStayPlaces(List<StayPlace> stayPlaces) { 
    212212                stayPlaces_ = stayPlaces; 
    213213        } 
     
    217217         */ 
    218218        @Override 
    219         public Set<com.kh.ssme.model.ifc.Calendar> getCalendars() { 
     219        public List<com.kh.ssme.model.ifc.Calendar> getCalendars() { 
    220220                return calendars_; 
    221221        } 
    222222 
    223223        /* (non-Javadoc) 
    224          * @see com.kh.ssme.model.ifc.User#setCalendars(java.util.Set) 
    225          */ 
    226         @Override 
    227         public void setCalendars(Set<com.kh.ssme.model.ifc.Calendar> calendars) { 
     224         * @see com.kh.ssme.model.ifc.User#setCalendars(java.util.List) 
     225         */ 
     226        @Override 
     227        public void setCalendars(List<com.kh.ssme.model.ifc.Calendar> calendars) { 
    228228                calendars_ = calendars; 
    229229        } 
     
    233233         */ 
    234234        @Override 
    235         public Set<Group> getOwnedGroups() { 
     235        public List<Group> getOwnedGroups() { 
    236236                return ownedGroups_; 
    237237        } 
    238238 
    239239        /* (non-Javadoc) 
    240          * @see com.kh.ssme.model.ifc.User#setOwnedGroups(java.util.Set) 
    241          */ 
    242         @Override 
    243         public void setOwnedGroups(Set<Group> ownedGroups) { 
     240         * @see com.kh.ssme.model.ifc.User#setOwnedGroups(java.util.List) 
     241         */ 
     242        @Override 
     243        public void setOwnedGroups(List<Group> ownedGroups) { 
    244244                ownedGroups_ = ownedGroups; 
    245245        } 
  • ssme/trunk/src/com/kh/ssme/model/ifc/Group.java

    r4022 r4026  
    2323package com.kh.ssme.model.ifc; 
    2424 
    25 import java.util.Set; 
     25import java.util.List; 
    2626 
    2727/** 
     
    3232        //private String name_ = ""; 
    3333        //private String description_ = "";      
    34         //private Set<User> users_ = new TreeSet<User>(); 
     34        //private List<User> users_ = new ArrayList<User>(); 
    3535        //private User owner_ = new User();      
    3636                 
     
    4444        public void setDescription(String description); 
    4545         
    46         public Set<User> getUsers(); 
     46        public List<User> getUsers(); 
    4747         
    48         public void setUsers(Set<User> users); 
     48        public void setUsers(List<User> users); 
    4949         
    5050        public User getOwner(); 
  • ssme/trunk/src/com/kh/ssme/model/ifc/User.java

    r4022 r4026  
    2323package com.kh.ssme.model.ifc; 
    2424 
    25 import java.util.Set; 
    26  
    27 import javax.persistence.Basic; 
    28 import javax.persistence.Column; 
     25import java.util.List; 
    2926 
    3027/** 
     
    3835        //private String mail_ = ""; 
    3936        //private String mobile_ = "";   
    40         //private Set<GroupEntity> groups = new TreeSet<GroupEntity>(); 
    41         //private Set<StayPlace> stayPlaces_ = new TreeSet<StayPlace>(); 
    42         //private Set<com.kh.ssme.model.ifc.Calendar> calendars_ = new TreeSet<com.kh.ssme.model.ifc.Calendar>(); 
    43         //private Set<Group> ownedGroups_ = new TreeSet<Group>(); 
     37        //private List<GroupEntity> groups = new ArrayList<GroupEntity>(); 
     38        //private List<StayPlace> stayPlaces_ = new ArrayList<StayPlace>(); 
     39        //private List<com.kh.ssme.model.ifc.Calendar> calendars_ = new ArrayList<com.kh.ssme.model.ifc.Calendar>(); 
     40        //private List<Group> ownedGroups_ = new ArrayList<Group>(); 
    4441         
    4542        public String getLogin(); 
     
    6360        public void setMobile(String mobile);    
    6461         
    65         public Set<Group> getGroups(); 
     62        public List<Group> getGroups(); 
    6663         
    67         public void setGroups(Set<Group> groups);  
     64        public void setGroups(List<Group> groups);  
    6865         
    69         public Set<StayPlace> getStayPlaces(); 
     66        public List<StayPlace> getStayPlaces(); 
    7067         
    71         public void setStayPlaces(Set<StayPlace> stayPlaces); 
     68        public void setStayPlaces(List<StayPlace> stayPlaces); 
    7269         
    73         public Set<com.kh.ssme.model.ifc.Calendar> getCalendars(); 
     70        public List<com.kh.ssme.model.ifc.Calendar> getCalendars(); 
    7471         
    75         public void setCalendars(Set<com.kh.ssme.model.ifc.Calendar> calendars); 
     72        public void setCalendars(List<com.kh.ssme.model.ifc.Calendar> calendars); 
    7673         
    77         public Set<Group> getOwnedGroups(); 
     74        public List<Group> getOwnedGroups(); 
    7875         
    79         public void setOwnedGroups(Set<Group> ownedGroups);      
     76        public void setOwnedGroups(List<Group> ownedGroups);     
    8077         
    8178} 
  • ssme/trunk/src/com/kh/ssme/rest/parsers/JSONEntityCreator.java

    r4022 r4026  
    111111                //private User owner_ = new User();      
    112112                 
     113                create((BasicData)group, json);          
     114                 
    113115                if(group.getName() != null){ 
    114116                        json.put("name", group.getName());                       
     
    118120                        json.put("description", group.getDescription());                         
    119121                }                        
     122                 
     123                if(group.getOwner() != null){ 
     124                        JSONObject owner = new JSONObject(); 
     125                        create(group.getOwner(), owner); 
     126                        json.put("owner", owner);                        
     127                }                
    120128                 
    121129                if(group.getUsers() != null){ 
     
    128136                        json.put("users", users); 
    129137                }        
    130                  
    131                 if(group.getOwner() != null){ 
    132                         json.put("owner", group.getOwner().getUUID());                   
    133                 }        
     138                         
    134139        } 
    135140 
     
    211216                //private Set<com.kh.ssme.model.ifc.Calendar> calendars_ = new TreeSet<com.kh.ssme.model.ifc.Calendar>(); 
    212217                //private Set<Group> ownedGroups_ = new TreeSet<Group>(); 
     218                 
     219                create((BasicData)user, json);           
    213220                         
    214221                if(user.getLogin() != null){ 
  • ssme/trunk/src/com/kh/ssme/rest/parsers/JSONEntityMerger.java

    r4022 r4026  
    110110                //private User owner_ = new User();      
    111111                 
    112                 JSONObject json = (JSONObject)o; 
    113                 Set<User> tempSet = new TreeSet<User>();                 
     112                JSONObject json = (JSONObject)o;         
    114113                 
    115114                String name = (String) json.get("name"); 
     
    125124                JSONArray users = (JSONArray) json.get("users"); 
    126125                if(users != null){ 
     126                        group.getUsers().clear();                        
    127127                        for (Object ob : users) { 
    128                                 String uuid = (String) ob; 
    129                                 if(uuid!=null){ 
    130                                         boolean add = true; 
    131                                         for(User u : group.getUsers()){ 
    132                                                 if(uuid.equalsIgnoreCase(u.getUUID())){ 
    133                                                         tempSet.add(u); 
    134                                                         add = false; 
    135                                                         break; 
    136                                                 }                        
    137                                         } 
    138                                         if(add){ 
    139                                                 tempSet.add(UserManager.findUserByUUID(uuid)); 
    140                                         } 
    141                                 } 
     128                                String uuid = (String) ob;                               
     129                                group.getUsers().add(UserManager.findUserByUUID(uuid)); 
    142130                        } 
    143                         group.getUsers().clear(); 
    144                         group.getUsers().addAll(tempSet); 
    145                         tempSet.clear(); 
    146131                } 
    147132                 
     
    250235                        user.setMobile(mobile);                  
    251236                }                
    252  
    253                 Set<Group> tempSet = new TreeSet<Group>();                               
     237                         
    254238                JSONArray groups = (JSONArray) json.get("groups"); 
    255239                if(groups != null){ 
     240                        user.getGroups().clear();                        
    256241                        for (Object ob : groups) { 
    257242                                String uuid = (String) ob; 
    258                                 if(uuid!=null){ 
    259                                         boolean add = true; 
    260                                         for(Group g : user.getGroups()){ 
    261                                                 if(uuid.equalsIgnoreCase(g.getUUID())){ 
    262                                                         tempSet.add(g); 
    263                                                         add = false; 
    264                                                         break; 
    265                                                 }                        
    266                                         } 
    267                                         if(add){ 
    268                                                 tempSet.add(GroupManager.findGroupByUUID(uuid)); 
    269                                         } 
    270                                 } 
     243                                user.getGroups().add(GroupManager.findGroupByUUID(uuid)); 
    271244                        } 
    272                         user.getGroups().clear(); 
    273                         user.getGroups().addAll(tempSet); 
    274  
    275                 } 
    276                  
    277                 tempSet.clear();                 
     245                } 
     246         
    278247                JSONArray ownedGroups = (JSONArray) json.get("ownedGroups"); 
    279248                if(ownedGroups != null){ 
     249                        user.getOwnedGroups().clear();                   
    280250                        for (Object ob : ownedGroups) { 
    281251                                String uuid = (String) ob; 
    282                                 if(uuid!=null){ 
    283                                         boolean add = true; 
    284                                         for(Group g : user.getOwnedGroups()){ 
    285                                                 if(uuid.equalsIgnoreCase(g.getUUID())){ 
    286                                                         tempSet.add(g); 
    287                                                         add = false;                                                     
    288                                                         break; 
    289                                                 }                        
    290                                         } 
    291                                         if(add){ 
    292                                                 tempSet.add(GroupManager.findGroupByUUID(uuid)); 
    293                                         } 
    294                                 } 
     252                                user.getOwnedGroups().add(GroupManager.findGroupByUUID(uuid)); 
    295253                        } 
    296                         user.getOwnedGroups().clear(); 
    297                         user.getOwnedGroups().addAll(tempSet); 
    298254                }                
    299255                 
  • ssme/trunk/web/css/ssme.css

    r4022 r4026  
    6666        } 
    6767         
     68         
     69 
     70        /** 
     71         *      form fields 
     72         */ 
    6873input{ 
    6974                border: 0px solid red; 
     
    8792                opacity:0.6     ; 
    8893                font-color: black;               
     94        }        
     95         
     96         
     97                 
     98        /** 
     99         * lists of 
     100         * users, groups 
     101         */ 
     102ul.groupList, ul.userList{        
     103                list-style-type: none 
     104        }         
     105ul.groupList li, ul.userList li{ 
     106                padding: 3px; 
     107                 
     108        } 
     109         
     110         
     111         
     112        /** 
     113         *      Wrappers 
     114         */      
     115.excludedFromLayout{ 
     116                visibility: hidden; 
     117                position: absolute;  
     118        } 
     119span .container{ 
     120                padding: 0px; 
     121                margin: 0px; 
     122                border: 0px; 
     123        } 
     124         
     125         
     126         
     127        /** 
     128         * Toggle buttons 
     129         */ 
     130.toggleButton { 
     131                border: 2px solid #bbffbb; 
     132                padding: 1px 3px 1px 3px; 
     133                margin-left: 2px; 
     134                margin-right: 2px; 
     135        }         
     136         
     137.toggleOn { 
     138                border-style: inset;     
     139        } 
     140         
     141.toggleOff { 
     142                border-style: outset; 
    89143        }                
    90  
    91 .detailsButton { 
     144         
     145         
     146         
     147        /** 
     148         *      buttons 
     149         */ 
     150a {      
     151                text-decoration: none; 
     152        } 
     153a .faceboxButton { 
     154                border:2px outset #bbffbb; 
     155                padding: 1px 3px 1px 3px; 
     156        }        
     157a:hover .faceboxButton{ 
    92158                border:1px outset #bbffbb; 
     159                padding: 2px 4px 2px 4px; 
    93160        } 
     161         
     162a:active .faceboxButton{ 
     163                border:1px inset #bbffbb; 
     164                padding: 2px 4px 2px 4px; 
     165        } 
     166         
     167.button a{ 
     168                border:2px outset #bbffbb; 
     169                padding: 1px 3px 1px 3px; 
     170        }        
     171.button a:hover{ 
     172                border:1px outset #bbffbb; 
     173                padding: 2px 4px 2px 4px; 
     174        } 
     175         
     176.button a:active{ 
     177                border:1px inset #bbffbb; 
     178                padding: 2px 4px 2px 4px; 
     179        }        
     180         
    94181 
    95182         
  • ssme/trunk/web/group.jsp

    r4022 r4026  
    1010 
    1111        <jsp:body> 
     12         
    1213                <ssme:group id="group" editable="true" /> 
     14                 
     15                <ssme:user id="userDetails" infoOnly="true" />                   
     16                 
    1317        </jsp:body> 
    1418 
  • ssme/trunk/web/script/facebox.js

    r4025 r4026  
    9393                var f = this; 
    9494                $$('a[rel=facebox]').each(function(elem,i){ 
    95                         Event.observe(elem, 'click', function(e){ 
    96                                 // console.log("here's what f is :: "+ f); 
     95                                Event.observe(elem, 'click', function(e){ 
    9796                                Event.stop(e); 
    9897                                f.click_handler(elem, e); 
    9998                        }); 
    10099                }); 
    101                  
    102100        }, 
    103101         
     
    138136         
    139137        close           : function(){ 
     138                // restore parent 
     139                this.restore_to_parent(); 
     140         
    140141                new Effect.Fade('facebox', { duration: 0.2 }); 
    141142        }, 
     
    143144        setLocation: function(){ 
    144145                var pageScroll = document.viewport.getScrollOffsets(); 
    145                 var top = /*pageScroll.top +*/ (document.viewport.getHeight()/ 10); 
     146                var top = pageScroll.top + (document.viewport.getHeight()/ 10); 
    146147                var left = (document.viewport.getWidth()/2) - ($('facebox').getWidth()) + ($('facebox').getWidth()/2); 
    147148                $('facebox').setStyle({ 
     
    174175         
    175176        click_handler   : function(elem, e){ 
     177                // restore parent 
     178                this.restore_to_parent(); 
     179         
    176180                this.loading(); 
    177181                Event.stop(e); 
     
    206210                        fb.ajax(url, klass); 
    207211                } 
     212        }, 
     213         
     214         
     215         
     216        //----------------------------------------------------------------- 
     217        // SSME specific 
     218        /** 
     219         * Reference to parent of element that will be show in facebox 
     220         */ 
     221        parent : null, 
     222        /** 
     223         * contetn id 
     224         */ 
     225        contentID : null, 
     226         
     227        /** 
     228         * Restores content to it's basic parent 
     229         */ 
     230        restore_to_parent : function(){ 
     231                if(this.parent!=null){                                                           
     232                        Element.insert(this.parent, { bottom: $(this.contentID).remove() });                                                                             
     233                }                
     234                this.parent = null; 
     235        }, 
     236         
     237        buttonClick_handler     : function(elem){                
     238                // restore parent 
     239                this.restore_to_parent(); 
     240                 
     241                this.loading(); 
     242                                 
     243                // div 
     244                this.open(); 
     245                         
     246                if (elem.href.match(/#/)){ 
     247                        var url                 = window.location.href.split('#')[0]; 
     248                        this.contentID  = elem.href.replace(url+'#','');         
     249                         
     250                        //store parent and move object   
     251                        var d                   = $(this.contentID); 
     252                        this.parent = d.parentNode;              
     253                        var data = new Element(d.parentNode.tagName); 
     254                        Element.insert(data, { bottom: d.remove() });   //move object                                    
     255                         
     256                        this.reveal(data, ''); 
     257                }                
    208258        } 
     259        //-----------------------------------------------------------------      
     260         
    209261}); 
    210262 
  • ssme/trunk/web/script/group.js

    r4023 r4026  
    55 
    66Group.prototype = { 
     7        //------------------------------------------- 
     8        // ATTRIBUTES 
     9        //                       
    710        /** 
    811         * unique ID of this component 
     
    2528        thisForm : null,         
    2629         
     30        // 
     31        //-------------------------------------------    
     32         
     33         
     34         
     35        //------------------------------------------- 
     36        // INITIALIZE 
     37        //               
    2738        initialize: function(formElement){ 
    28                 $('logger').innerHTML += "Group.initialize()" + "<br/>";                  
     39                          
    2940                this.id = Element.identify(formElement);                 
    30                 $('logger').innerHTML += "formElement.id:[" + this.id + "]";                             
     41                Logger.debug("Group.initialize() formElement.id:[" + this.id + "] UUDI[" + $(this.id+"_uuid").value + "]");                              
    3142                this.thisForm = { 
     43                        //fields                                 
    3244                        uuid            : $(this.id+"_uuid"), 
    3345                        name            : $(this.id+"_name"), 
    3446                        description : $(this.id+"_description"),                                                 
    35                         owner_login     : $(this.id+"_owner_login") 
     47                        owner_login     : $(this.id+"_owner_login"), 
     48                         
     49                        //buttons 
     50                        apply_button: $(this.id+"_apply"), 
     51                        edit_button : $(this.id+"_edit")                         
    3652                }; 
     53                this.isNew = (this.thisForm.uuid.value == "");           
     54                 
     55                //submit button 
     56                if(this.thisForm.apply_button){          
     57                        this.thisForm.apply_button.onclick = this.onApply.bindAsEventListener(this);                                     
     58                } 
     59                 
    3760                //editable 
    38                 $(this.id+"_edit").checked = true; 
    39                 $(this.id+"_edit").onmouseup = this.changeEdit.bindAsEventListener(this, $(this.id+"_edit"));            
    40                 $(this.id+"_edit").onmouseup(); 
    41                 $(this.id+"_edit").checked = false; 
     61                if(this.thisForm.edit_button){   
     62                        this.thisForm.edit_button.toggle.toggleOn  = this.onEdit.bindAsEventListener(this, this.thisForm.edit_button, $$("#"+this.id+" tr.controlRow .submit")[0]);              
     63                        this.thisForm.edit_button.toggle.toggleOff = this.onEdit.bindAsEventListener(this, this.thisForm.edit_button, $$("#"+this.id+" tr.controlRow .submit")[0]);                      
     64                }        
    4265                 
    4366                //users list - details buttons 
    4467                $$("ul.userList li").each( 
    4568                        function(el){ 
    46                                 var elId = el.identify(); 
    47                                 $$('#'+elId+' input.detailsButton')[0].onmouseup = this.onGroupLiClick.bindAsEventListener(this, el, elId);                              
    48                         }.bind(this) 
     69                                var liId = el.identify(); 
     70                                var aElement = $$('#'+liId+' span.detailsButton a')[0]; 
     71                                aElement.onclick = this.onUserLiClick.bindAsEventListener(this, aElement, liId);                                 
     72                        }.bind(this)                     
    4973                ); 
     74                 
     75                //add to instances 
     76                Group.instances.set(this.id, this); 
    5077        }, 
    51          
    52         loadGroup: function(group){ 
     78        /** 
     79         * Catch the onsubmit event - to make sure it is not submitted :) 
     80         */      
     81        onSubmit : function(event) 
     82        { 
     83                return false; 
     84        },               
     85         
     86        // 
     87        //-------------------------------------------            
     88         
     89         
     90         
     91        //------------------------------------------- 
     92        // LOAD 
     93        // 
     94         
     95        loadGroup: function(group){      
    5396                this.thisForm.uuid.value = group.uuid; 
    5497                this.thisForm.name.value = group.name; 
    55                 this.thisForm.name.description.iinnerHTML = group.description; 
     98                this.thisForm.description.innerHTML = group.description; 
    5699                this.thisForm.owner_login.value = group.owner.login;             
     100                Logger.debug("Group.loadGroup() : " + group.uuid + " | " + group.name + " | " + group.owner.login + " | " + group.owner); 
    57101                 
    58102                this.isNew = (this.thisForm.uuid.value == ""); 
    59103        },       
    60104         
    61         load: function(){ 
    62                          
    63                  var req = new Ajax.Request("/group/"+this.thisForm.uuid.value,  
    64                                   { 
    65                                                 method: "get", 
    66                                                 onSuccess: function(resp)  
    67                                                 { 
    68                                                         if ( resp.responseJSON === null ) 
    69                                                         { 
    70                                                                 resp.responseJSON = resp.responseText.evalJSON(); 
    71                                                         } 
    72                                                         this.loadGroup(resp.responseJSON);  
    73                                                         if (this.onLoad != null) 
    74                                                         { 
    75                                                                 this.onLoad(this, true); 
    76                                                         }  
    77                                                 } 
    78                                                 .bind(this), 
    79                                                 onFailure: function(transport, problem) 
    80                                                 { 
    81                                                         try {  console.debug(problem); } catch (e) {}; 
    82                                                         if (this.onLoad != null) 
    83                                                         { 
    84                                                                 this.onLoad(this, true); 
    85                                                         }  
    86                                                 } 
    87                                                 .bind(this) 
    88                                         });              
     105        load: function(uuid){ 
     106                 
     107                if(uuid){ 
     108                        this.thisForm.uuid.value = uuid; 
     109                }                
     110                 
     111                Logger.debug("Group.load() PATH : " + CONTEXT_PATH+"/group/"+this.thisForm.uuid.value);  
     112                var req = new Ajax.Request(CONTEXT_PATH+"/group/"+this.thisForm.uuid.value,  
     113                { 
     114                        method: "get", 
     115                        onSuccess: function(resp){ 
     116                                if ( resp.responseJSON === null ) 
     117                                { 
     118                                        resp.responseJSON = resp.responseText.evalJSON(); 
     119                                } 
     120                                this.loadGroup(resp.responseJSON);  
     121                                if (this.onLoad != null) 
     122                                { 
     123                                        this.onLoad(this, true); 
     124                                }                                                
     125                        }.bind(this), 
     126                        onFailure: function(transport, problem){ 
     127                                Logger.error("Group.load.onFailure  TRANSPORT:" + Util.listAttributes(transport) + " PROBLEM:" + Util.listAttributes(problem)); 
     128                                try {  console.debug(problem); } catch (e) {}; 
     129                                if (this.onLoad != null) 
     130                                { 
     131                                        this.onLoad(this, true); 
     132                                }  
     133                        }.bind(this) 
     134                });              
    89135                  
    90136        },                                               
     137         
     138        /** 
     139         * on-load callback  function (this-object, wasSuccessful) 
     140         */ 
     141        onLoad: null,    
     142         
     143        // 
     144        //-------------------------------------------    
     145         
     146         
     147         
     148        //------------------------------------------- 
     149        // SAVE 
     150        // 
    91151         
    92152        saveGroup: function(group){ 
     
    94154        },        
    95155                 
    96         /** 
    97          * on-load callback  function (this-object, wasSuccessful) 
    98          */ 
    99         onLoad: null, 
     156        save: function(){ 
     157                var groupObject = $H( 
     158                { 
     159                        uuid                    : this.thisForm.uuid.value,      
     160                        name                    : this.thisForm.name.value, 
     161                        description             : this.thisForm.description.value, 
     162                        owner_login             : this.thisForm.owner_login.value                
     163                });      
     164                                         
     165                Logger.debug("Group.save() Group.toJSON() : " + groupObject.toJSON());                   
     166                 
     167                var _method = ( this.isNew ) ? "put" : "post"; 
     168                var additionalParameter = ( this.isNew ) ? "?_method=put" : ""; 
     169                         
     170                Logger.debug("Group.save() PATH : " + CONTEXT_PATH+"/group/"+this.thisForm.uuid.value+additionalParameter); 
     171                var req = new Ajax.Request(CONTEXT_PATH+"/group/"+this.thisForm.uuid.value+additionalParameter,  
     172                { 
     173                        method: _method, 
     174                        contentType: "application/json", 
     175                        postBody: groupObject.toJSON(), 
     176                        onSuccess: this.onSuccessSave.bind(this), 
     177                        onComplete: function(resp){ 
     178                                Logger.debug("Group.save.onComplete : RESP:" + resp); 
     179                        }, 
     180                        onFailure: function(transport, problem){ 
     181                                Logger.error("Group.save.onFailure  TRANSPORT:" + Util.listAttributes(transport) + " PROBLEM:" + Util.listAttributes(problem));                                  
     182                                try {  console.debug(problem); } catch (e) {}; 
     183                                if (this.onSave != null) 
     184                                { 
     185                                        this.onSave(this, false); 
     186                                }  
     187                        }.bind(this) 
     188                });              
     189        },       
     190         
     191        /** 
     192         * It was impossible to find any bug when it was inside the previous 
     193         * function. 
     194         */ 
     195        onSuccessSave: function(resp) { 
     196                if ( resp.responseJSON === null )                
     197                {                        
     198                        resp.responseJSON = resp.responseText.evalJSON(); 
     199                }                        
     200                this.loadGroup(resp.responseJSON);  
     201                if (this.onSave != null) 
     202                { 
     203                        this.onSave(this, true); 
     204                }  
     205        }, 
    100206         
    101207        /** 
     
    103209         */ 
    104210        onSave: null,            
    105  
    106         onGroupLiClick: function(event, element, elId){ 
    107                  facebox.reveal(event+'<br/>'+element+'<br/>'+elId+'</br> for group with UUID:'+this.thisForm.uuid.value,''); 
     211         
     212        // 
     213        //-------------------------------------------    
     214         
     215         
     216         
     217        //------------------------------------------- 
     218        // LISTENERS 
     219        // 
     220         
     221        onApply: function(event){ 
     222                 Logger.debug("Group.onApply"); 
     223                 this.save(); 
    108224        }, 
    109225         
    110         changeEdit: function(event, element){ 
    111                 var disable = element.checked; 
    112                 $('logger').innerHTML += disable+' -> '+element.checked + "<br/>";       
    113                 $$('#'+this.id+' .editable').each( 
     226        onCancel: function(event){ 
     227                Logger.debug("Group.onCancel"); 
     228                this.load(this.thisForm.uuid.value); 
     229        },               
     230         
     231        onEdit: function(event, element, submit){        
     232                var isOn = element.toggle.stateIsOn 
     233                Logger.debug("Group.onEdit isOn["+isOn+"]");             
     234                $$('#'+this.id+' input.editable').each( 
    114235                        function(el){ 
    115                                 el.disabled = disable; 
    116                                 Element.addClassName(el,(disable)?'disabledInput':'enabledInput'); 
    117                                 Element.removeClassName(el,(disable)?'enabledInput':'disabledInput'); 
     236                                el.disabled = !isOn; 
     237                                Element.addClassName(el,(isOn)?'enabledInput':'disabledInput'); 
     238                                Element.removeClassName(el,(isOn)?'disabledInput':'enabledInput'); 
    118239                        }.bind(this) 
    119240                );       
    120         } 
     241                if(isOn){       //enable submit 
     242                        Element.removeClassName(submit,'excludedFromLayout'); 
     243                } else {        //disable submit         
     244                        Element.addClassName(submit,'excludedFromLayout'); 
     245                        this.onCancel(event);    
     246                } 
     247        },               
     248 
     249        onUserLiClick: function(event, element, liId){          /* element: <a>, liId: UUID */ 
     250                  
     251                 Event.stop(event);                       
     252                 User.instances.get('userDetails').onLoad = function (){         
     253                         facebox.buttonClick_handler(element);   
     254                 } 
     255                 User.instances.get('userDetails').load(liId); 
     256                                          
     257        },               
     258         
     259        // 
     260        //-------------------------------------------            
    121261         
    122262} 
    123263 
     264/** 
     265* Collection of Group instances  
     266*/ 
     267Group.instances = $H({}); 
     268 
    124269Group.preload = function() { 
    125         $('logger').innerHTML += "Group.preload()" + "<br/>"; 
     270        Logger.debug("Group.preload()"); 
    126271        $$("form.groupForm").each( 
    127272                function(form){ 
  • ssme/trunk/web/script/user.js

    r4023 r4026  
    55 
    66User.prototype = { 
     7        //------------------------------------------- 
     8        // ATTRIBUTES 
     9        //                       
    710        /** 
    811         * unique ID of this component 
     
    2326         * The form that represents the user 
    2427         */ 
    25         thisForm : null,         
    26          
     28        thisForm : null, 
     29         
     30        // 
     31        //-------------------------------------------            
     32         
     33         
     34         
     35         
     36        //------------------------------------------- 
     37        // INITIALIZE 
     38        //       
    2739        initialize: function(formElement){ 
    28                 $('logger').innerHTML += "User.initialize()" + "<br/>";           
     40         
    2941                this.id = Element.identify(formElement);                 
    30                 $('logger').innerHTML += "formElement.id:[" + this.id + "]";                             
     42                Logger.debug("User.initialize() formElement.id:[" + this.id + "] UUDI[" + $(this.id+"_uuid").value + "]");               
    3143                this.thisForm = { 
     44                        // fields        
    3245                        uuid            : $(this.id+"_uuid"), 
    3346                        login           : $(this.id+"_login"), 
     
    3548                        surname         : $(this.id+"_surname"), 
    3649                        mail            : $(this.id+"_mail"), 
    37                         mobile          : $(this.id+"_mobile")                                           
     50                        mobile          : $(this.id+"_mobile"), 
     51                         
     52                        //buttons 
     53                        apply_button: $(this.id+"_apply"), 
     54                        edit_button : $(this.id+"_edit") 
    3855                }; 
     56                this.isNew = (this.thisForm.uuid.value == ""); 
     57                 
     58                //submit button 
     59                if(this.thisForm.apply_button){          
     60                        this.thisForm.apply_button.onclick = this.onApply.bindAsEventListener(this);                                     
     61                } 
     62                 
    3963                //editable 
    40                 $('logger').innerHTML += (this.id+"_edit")+' -> '+$(this.id+"_edit") + "<br/>";                  
    41                 $(this.id+"_edit").checked = true; 
    42                 $(this.id+"_edit").onmouseup = this.changeEdit.bindAsEventListener(this, $(this.id+"_edit"));            
    43                 $(this.id+"_edit").onmouseup(); 
    44                 $(this.id+"_edit").checked = false; 
     64                if(this.thisForm.edit_button){   
     65                        this.thisForm.edit_button.toggle.toggleOn  = this.onEdit.bindAsEventListener(this, this.thisForm.edit_button, $$("#"+this.id+" tr.controlRow .submit")[0]);              
     66                        this.thisForm.edit_button.toggle.toggleOff = this.onEdit.bindAsEventListener(this, this.thisForm.edit_button, $$("#"+this.id+" tr.controlRow .submit")[0]);                      
     67                }                
    4568                 
    4669                //group lists - details buttons 
    4770                $$("ul.groupList li").each( 
    4871                        function(el){ 
    49                                 var elId = el.identify(); 
    50                                 $$('#'+elId+' input.detailsButton')[0].onmouseup = this.onGroupLiClick.bindAsEventListener(this, el, elId);                              
    51                         }.bind(this) 
    52                 );       
     72                                var liId = el.identify(); 
     73                                var aElement = $$('#'+liId+' span.detailsButton a')[0];  
     74                                aElement.onclick = this.onGroupLiClick.bindAsEventListener(this, aElement, liId);                                
     75                        }.bind(this) 
     76                );                                       
     77                 
     78                 
     79                //add to instances 
     80                User.instances.set(this.id, this);               
    5381        }, 
     82         
     83        /** 
     84         * Catch the onsubmit event - to make sure it is not submitted :) 
     85         */      
     86        onSubmit : function(event) 
     87        { 
     88                return false; 
     89        },               
     90         
     91        // 
     92        //-------------------------------------------    
     93         
     94         
     95         
     96        //------------------------------------------- 
     97        // LOAD 
     98        // 
    5499         
    55100        loadUser: function(user){ 
     
    60105                this.thisForm.mail.value = user.mail; 
    61106                this.thisForm.mobile.value = user.mobile;                
    62                  
     107 
    63108                this.isNew = (this.thisForm.uuid.value == ""); 
    64109        },       
    65110         
    66         load: function(){ 
    67                          
    68                  var req = new Ajax.Request("/user/"+this.thisForm.uuid.value,  
    69                                   { 
    70                                                 method: "get", 
    71                                                 onSuccess: function(resp)  
    72                                                 { 
    73                                                         if ( resp.responseJSON === null ) 
    74                                                         { 
    75                                                                 resp.responseJSON = resp.responseText.evalJSON(); 
    76                                                         } 
    77                                                         this.loadUser(resp.responseJSON);  
    78                                                         if (this.onLoad != null) 
    79                                                         { 
    80                                                                 this.onLoad(this, true); 
    81                                                         }  
    82                                                 } 
    83                                                 .bind(this), 
    84                                                 onFailure: function(transport, problem) 
    85                                                 { 
    86                                                         try {  console.debug(problem); } catch (e) {}; 
    87                                                         if (this.onLoad != null) 
    88                                                         { 
    89                                                                 this.onLoad(this, true); 
    90                                                         }  
    91                                                 } 
    92                                                 .bind(this) 
    93                                         });              
     111        load: function(uuid){ 
     112                 
     113                if(uuid){ 
     114                        this.thisForm.uuid.value = uuid; 
     115                } 
     116                         
     117                Logger.debug("User.load() PATH : " + CONTEXT_PATH+"/user/"+this.thisForm.uuid.value);            
     118                var req = new Ajax.Request(CONTEXT_PATH+"/user/"+this.thisForm.uuid.value,  
     119                { 
     120                        method: "get", 
     121                        onSuccess: function(resp){ 
     122                                if ( resp.responseJSON === null ) 
     123                                { 
     124                                        resp.responseJSON = resp.responseText.evalJSON(); 
     125                                } 
     126                                this.loadUser(resp.responseJSON);  
     127                                if (this.onLoad != null) 
     128                                { 
     129                                        this.onLoad(this, true); 
     130                                }  
     131                        }.bind(this), 
     132                        onFailure: function(transport, problem){ 
     133                                Logger.error("User.load.onFailure  TRANSPORT:" + Util.listAttributes(transport) + " PROBLEM:" + Util.listAttributes(problem));                                   
     134                                try {  console.debug(problem); } catch (e) {}; 
     135                                if (this.onLoad != null) 
     136                                { 
     137                                        this.onLoad(this, true); 
     138                                }  
     139                        }.bind(this) 
     140                });              
    94141                  
    95         },                                               
     142        },               
     143         
     144        /** 
     145         * on-load callback  function (this-object, wasSuccessful) 
     146         */ 
     147        onLoad: null, 
     148         
     149        // 
     150        //-------------------------------------------    
     151         
     152         
     153         
     154        //------------------------------------------- 
     155        // SAVE 
     156        // 
    96157         
    97158        saveUser: function(user){ 
     
    101162         
    102163        save: function(){ 
    103                  
    104         },       
    105          
    106         /** 
    107          * on-load callback  function (this-object, wasSuccessful) 
    108          */ 
    109         onLoad: null, 
     164                var userObject = $H( 
     165                { 
     166                        uuid                    : this.thisForm.uuid.value, 
     167                        login                   : this.thisForm.login.value,             
     168                        name                    : this.thisForm.name.value, 
     169                        surname                 : this.thisForm.surname.value, 
     170                        mail                    : this.thisForm.mail.value, 
     171                        mobile                  : this.thisForm.mobile.value                     
     172                });      
     173                                         
     174                Logger.debug("User.save() User.toJSON() : " + userObject.toJSON());                      
     175                 
     176                var _method = ( this.isNew ) ? "put" : "post"; 
     177                var additionalParameter = ( this.isNew ) ? "?_method=put" : ""; 
     178                         
     179                Logger.debug("User.save() PATH : " + CONTEXT_PATH+"/user/"+this.thisForm.uuid.value+additionalParameter); 
     180                var req = new Ajax.Request(CONTEXT_PATH+"/user/"+this.thisForm.uuid.value+additionalParameter,  
     181                { 
     182                        method: _method, 
     183                        contentType: "application/json", 
     184                        postBody: userObject.toJSON(), 
     185                        onSuccess: this.onSuccessSave.bind(this), 
     186                        onComplete: function(resp){ 
     187                                Logger.debug("User.save.onComplete : RESP:" + resp); 
     188                        }, 
     189                        onFailure: function(transport, problem){ 
     190                                Logger.error("User.save.onFailure  TRANSPORT:" + Util.listAttributes(transport) + " PROBLEM:" + Util.listAttributes(problem));                                   
     191                                try {  console.debug(problem); } catch (e) {}; 
     192                                if (this.onSave != null) 
     193                                { 
     194                                        this.onSave(this, false); 
     195                                }  
     196                        }.bind(this) 
     197                });              
     198        },       
     199         
     200        /** 
     201         * It was impossible to find any bug when it was inside the previous 
     202         * function. 
     203         */ 
     204        onSuccessSave: function(resp) { 
     205                if ( resp.responseJSON === null )                
     206                { 
     207                         
     208                        resp.responseJSON = resp.responseText.evalJSON(); 
     209                }                        
     210                this.loadUser(resp.responseJSON);  
     211                if (this.onSave != null) 
     212                { 
     213                        this.onSave(this, true); 
     214                }  
     215        }, 
    110216         
    111217        /** 
     
    114220        onSave: null,            
    115221         
    116         onGroupLiClick: function(event, element, elId){ 
    117                  alert('dimensions : ' + document.viewport.getDimensions() + ' | '+ 
    118                            'width : ' + document.viewport.getDimensions().width + ' | '+ 
    119                            'height : ' + document.viewport.getDimensions().height + ' | '+ 
    120                            ' }' 
    121                  );  
    122                  //facebox.reveal(event+'<br/>'+element+'<br/>'+elId+'</br> for user with UUID:'+this.thisForm.uuid.value,''); 
    123                  //facebox.reveal('<ssme:user id="user" editable="true" />','');                  
     222        // 
     223        //-------------------------------------------    
     224         
     225         
     226         
     227        //------------------------------------------- 
     228        // LISTENERS 
     229        // 
     230         
     231        onApply: function(event){ 
     232                 Logger.debug("User.onApply"); 
     233                 this.save(); 
    124234        }, 
    125235         
    126         changeEdit: function(event, element){ 
    127                 var disable = element.checked; 
    128                 $('logger').innerHTML += disable+' -> '+element.checked + "<br/>";       
     236        onCancel: function(event){ 
     237                Logger.debug("User.onCancel"); 
     238                this.load(this.thisForm.uuid.value); 
     239        },       
     240         
     241        onEdit: function(event, element, submit){        
     242                var isOn = element.toggle.stateIsOn 
     243                Logger.debug("User.onEdit isOn["+isOn+"]");              
    129244                $$('#'+this.id+' input.editable').each( 
    130245                        function(el){ 
    131                                 el.disabled = disable; 
    132                                 Element.addClassName(el,(disable)?'disabledInput':'enabledInput'); 
    133                                 Element.removeClassName(el,(disable)?'enabledInput':'disabledInput'); 
    134                         }.bind(this) 
    135                 ); 
    136         } 
     246                                el.disabled = !isOn; 
     247                                Element.addClassName(el,(isOn)?'enabledInput':'disabledInput'); 
     248                                Element.removeClassName(el,(isOn)?'disabledInput':'enabledInput'); 
     249                        }.bind(this) 
     250                );       
     251                if(isOn){       //enable submit 
     252                        Element.removeClassName(submit,'excludedFromLayout'); 
     253                } else {        //disable submit         
     254                        Element.addClassName(submit,'excludedFromLayout'); 
     255                        this.onCancel(event);    
     256                } 
     257        },       
     258          
     259        onGroupLiClick: function(event, element, liId){         /* element: <a>, liId: UUID */ 
     260                  
     261                 Event.stop(event);                       
     262                 Group.instances.get('groupDetails').onLoad = function (){       
     263                         facebox.buttonClick_handler(element);   
     264                 } 
     265                 Group.instances.get('groupDetails').load(liId); 
     266                                          
     267        }         
     268         
     269        // 
     270        //-------------------------------------------    
    137271         
    138272} 
    139273 
     274/** 
     275* Collection of User instances  
     276*/ 
     277User.instances = $H({}); 
     278 
    140279User.preload = function() { 
    141         $('logger').innerHTML += "User.preload()" + "<br/>"; 
     280        Logger.debug("User.preload()"); 
    142281        $$("form.userForm").each( 
    143282                function(form){ 
  • ssme/trunk/web/user.jsp

    r4024 r4026  
    1010 
    1111        <jsp:body> 
     12         
    1213                <ssme:user id="user" editable="true" />  
    13                 <!-- <ssme:user id="user" entity="${ rest:findUserByLogin('madmax') }"/> -->                             
     14                                         
     15                <ssme:group id="groupDetails" infoOnly="true" /> 
    1416                 
    15                 <ssme:user id="user" infoOnly="true" /> 
    1617        </jsp:body> 
    1718 
  • ssme/trunk/web/WEB-INF/tags/group.tag

    r4022 r4026  
    1515<c:if test="${ infoOnly eq true }"> 
    1616        <c:set var="editable" value="false"/> 
     17        <c:set var="entity" value="${ null }"/> 
     18        <c:set var="uuid" value="${ null }"/> 
    1719</c:if> 
    1820 
    19 <form class="groupForm" id="${ id }" action=""> 
    20         <input type="hidden" id="${ id }_uuid" value="${ uuid }" /> 
    21          
    22         <table> 
    23                 <tr class="title"> 
    24                         <td class="label"> 
    25                                 <label for="${ id }_name"> 
    26                                         Group name: 
    27                                 </label> 
    28                         </td> 
    29                         <td> 
    30                                 <input id="${ id }_name" class="editable disabledInput" disabled="true" value="${ entity.name }" /> 
    31                         </td> 
    32                 </tr> 
    33                 <tr class="title"> 
    34                         <td class="label"> 
    35                                 <label for="${ id }_description"> 
    36                                         Description: 
    37                                 </label> 
    38                         </td> 
    39                         <td> 
    40                                 <textarea id="${ id }_description" class="editable disabledInput" disabled="true" rows="4" cols="30">${ entity.description }</textarea>  
    41                         </td> 
    42                 </tr>    
    43                 <tr class="title"> 
    44                         <td class="label"> 
    45                                 <label for="${ id }_owner_login"> 
    46                                         Owner: 
    47                                 </label> 
    48                         </td> 
    49                         <td> 
    50                                 <input id="${ id }_owner_login" class="disabledInput" disabled="true" value="${ entity.owner.login }" /> 
    51                         </td> 
    52                 </tr>    
    53                 <c:if test="${ editable }"> 
    54                 <tr class="title"> 
    55                         <td class="label"> 
    56                                 <label for="${ id }_edit"> 
    57                                         Edit: 
    58                                 </label> 
    59                         </td> 
    60                         <td> 
    61                                 <input id="${ id }_edit" type="checkbox" /> 
    62                         </td> 
    63                 </tr> 
    64                 </c:if> 
    65         </table> 
    66                          
    67         <c:if test="${ infoOnly != true }"> 
    68                 <ul class="userList">                    
    69                         <c:forEach items="${entity.users}" var="user"> 
    70                                 <li id="${ user.UUID }" class="label" > 
    71                                         <span> 
    72                                                 <a href="${pageContext.request.contextPath}/user/${user.UUID}" > 
    73                                                         ${ user.login } 
    74                                                 </a> 
    75                                         </span>                          
    76                                         <span> 
    77                                                 <input class="detailsButton" type="button" value="details" /> 
    78                                         </span> 
    79                                 </li>    
    80                         </c:forEach> 
    81                 </ul>    
    82         </c:if>                  
    83            
    84 </form> 
     21<div id="${ id }_wrapper" class="${ (infoOnly)?'excludedFromLayout':'' }"> 
     22        <form class="groupForm" id="${ id }" action=""> 
     23                <input type="hidden" id="${ id }_uuid" value="${ uuid }" /> 
     24                 
     25                <table> 
     26                        <tr> 
     27                                <td class="label"> 
     28                                        <label for="${ id }_name"> 
     29                                                Group name: 
     30                                        </label> 
     31                                </td> 
     32                                <td> 
     33                                        <input id="${ id }_name" class="editable disabledInput" disabled="true" value="${ entity.name }" /> 
     34                                </td> 
     35                        </tr> 
     36                        <tr> 
     37                                <td class="label"> 
     38                                        <label for="${ id }_description"> 
     39                                                Description: 
     40                                        </label> 
     41                                </td> 
     42                                <td> 
     43                                        <textarea id="${ id }_description" class="editable disabledInput" disabled="true" rows="4" cols="30">${ entity.description }</textarea>  
     44                                </td> 
     45                        </tr>    
     46                        <tr> 
     47                                <td class="label"> 
     48                                        <label for="${ id }_owner_login"> 
     49                                                Owner: 
     50                                        </label> 
     51                                </td> 
     52                                <td> 
     53                                        <input id="${ id }_owner_login" class="disabledInput" disabled="true" value="${ entity.owner.login }" /> 
     54                                </td> 
     55                        </tr>    
     56                        <c:if test="${ editable }">      
     57                        <tr class="controlRow"> 
     58                                <td class="label" />                     
     59                                <td> 
     60                                        <span id="${ id }_edit" class="toggleButton">Edit</span> 
     61                                        <span class="button excludedFromLayout submit"><a id="${ id }_apply">Apply</a></span>            
     62                                </td> 
     63                        </tr> 
     64                        </c:if> 
     65                </table> 
     66                                 
     67                <c:if test="${ infoOnly != true }"> 
     68                        <ul class="userList">                    
     69                                <c:forEach items="${entity.users}" var="user"> 
     70                                        <li id="${ user.UUID }"> 
     71                                                <span> 
     72                                                        <a href="${pageContext.request.contextPath}/user/${user.UUID}" > 
     73                                                                ${ user.login } 
     74                                                        </a> 
     75                                                </span>                          
     76                                                <span class="detailsButton"> 
     77                                                        <a href="#userDetails"> 
     78                                                                <span class="faceboxButton">Details</span> 
     79                                                        </a> 
     80                                                </span>                                          
     81                                        </li>    
     82                                </c:forEach> 
     83                        </ul>    
     84                </c:if>                  
     85                   
     86        </form> 
     87</div> 
    8588 
  • ssme/trunk/web/WEB-INF/tags/head.tag

    r4022 r4026  
    1212        <script type="text/javascript" src="${pageContext.request.contextPath}/script/facebox.js" type="text/javascript"></script> 
    1313                 
     14        <script type="text/javascript" src="${pageContext.request.contextPath}/script/util.js" type="text/javascript"></script>          
     15                 
    1416        <script type="text/javascript" src="${pageContext.request.contextPath}/script/user.js" type="text/javascript"></script> 
    1517        <script type="text/javascript" src="${pageContext.request.contextPath}/script/group.js" type="text/javascript"></script>         
     18         
     19        <script type='text/javascript'>  
     20                /** 
     21                 * Global variables 
     22                 */ 
     23                 var CONTEXT_PATH = '${pageContext.request.contextPath}'; 
     24        </script> 
  • ssme/trunk/web/WEB-INF/tags/page.tag

    r4020 r4026  
    5757                                 
    5858                                <div id="loggerContainer">       
    59                                         [Method: ${pageContext.request.method}][Query String: ${pageContext.request.queryString}][Request URI: ${pageContext.request.requestURI}] 
    60                                         [Request URL: ${pageContext.request.requestURL}][Servlet Path: ${pageContext.request.servletPath}][Context Path: ${pageContext.request.contextPath}] 
     59                                        <div style="padding: 5px 5px 5px 5px; border: 1px solid black;"> 
     60                                                <span style="border: 2px outset black; padding: 1px 5px 1px 5px;" onClick="$('logger').innerHTML = '';">Clear Log</span> 
     61                                                [Method: ${pageContext.request.method}][Query String: ${pageContext.request.queryString}][Request URI: ${pageContext.request.requestURI}] 
     62                                                [Request URL: ${pageContext.request.requestURL}][Servlet Path: ${pageContext.request.servletPath}][Context Path: ${pageContext.request.contextPath}]                                     
     63                                        </div> 
    6164                                        <div id="logger" />      
    6265                                </div> 
  • ssme/trunk/web/WEB-INF/tags/user.tag

    r4022 r4026  
    1515<c:if test="${ infoOnly eq true }"> 
    1616        <c:set var="editable" value="false"/> 
     17        <c:set var="entity" value="${ null }"/> 
     18        <c:set var="uuid" value="${ null }"/>    
    1719</c:if> 
    1820 
    19 <form class="userForm" id="${ id }" action=""> 
    20         <input type="hidden" id="${ id }_uuid" value="${ uuid }" /> 
    21          
    22         <table> 
    23                 <tr class="title"> 
    24                         <td class="label"> 
    25                                 <label for="${ id }_login"> 
    26                                         Login: 
    27                                 </label> 
    28                         </td> 
    29                         <td> 
    30                                 <input id="${ id }_login" class="disabledInput" disabled="true" value="${ entity.login }" /> 
    31                         </td> 
    32                 </tr> 
    33                 <tr class="title"> 
    34                         <td class="label"> 
    35                                 <label for="${ id }_name"> 
    36                                         Name: 
    37                                 </label> 
    38                         </td> 
    39                         <td> 
    40                                 <input id="${ id }_name" class="editable disabledInput" disabled="true" value="${ entity.name }" /> 
    41                         </td> 
    42                 </tr> 
    43                 <tr class="title"> 
    44                         <td class="label"> 
    45                                 <label for="${ id }_surname"> 
    46                                         Surname: 
    47                                 </label> 
    48                         </td> 
    49                         <td> 
    50                                 <input id="${ id }_surname" class="editable disabledInput" disabled="true" value="${ entity.surname }" /> 
    51                         </td> 
    52                 </tr> 
    53                 <tr class="title"> 
    54                         <td class="label"> 
    55                                 <label for="${ id }_mail"> 
    56                                         Mail: 
    57                                 </label> 
    58                         </td> 
    59                         <td> 
    60                                 <input id="${ id }_mail" class="editable disabledInput" disabled="true" value="${ entity.mail }" /> 
    61                         </td> 
    62                 </tr> 
    63                 <tr class="title"> 
    64                         <td class="label"> 
    65                                 <label for="${ id }_mobile"> 
    66                                         Mobile: 
    67                                 </label> 
    68                         </td> 
    69                         <td> 
    70                                 <input id="${ id }_mobile" class="editable disabledInput" disabled="true" value="${ entity.mobile }" /> 
    71                         </td> 
    72                 </tr> 
    73                 <c:if test="${ editable }"> 
    74                 <tr class="title"> 
    75                         <td class="label"> 
    76                                 <label for="${ id }_edit"> 
    77                                         Edit: 
    78                                 </label> 
    79                         </td> 
    80                         <td> 
    81                                 <input id="${ id }_edit" type="checkbox" /> 
    82                         </td> 
    83                 </tr> 
     21<div id="${ id }_wrapper" class="${ (infoOnly)?'excludedFromLayout':'' }"> 
     22        <form class="userForm" id="${ id }" action=""> 
     23                <input type="hidden" id="${ id }_uuid" value="${ uuid }" /> 
     24                 
     25                <table> 
     26                        <tr> 
     27                                <td class="label"> 
     28                                        <label for="${ id }_login"> 
     29                                                Login: 
     30                                        </label> 
     31                                </td> 
     32                                <td> 
     33                                        <input id="${ id }_login" class="disabledInput" disabled="true" value="${ entity.login }" /> 
     34                                </td> 
     35                        </tr> 
     36                        <tr> 
     37                                <td class="label"> 
     38                                        <label for="${ id }_name"> 
     39                                                Name: 
     40                                        </label> 
     41                                </td> 
     42                                <td> 
     43                                        <input id="${ id }_name" class="editable disabledInput" disabled="true" value="${ entity.name }" /> 
     44                                </td> 
     45                        </tr> 
     46                        <tr> 
     47                                <td class="label"> 
     48                                        <label for="${ id }_surname"> 
     49                                                Surname: 
     50                                        </label> 
     51                                </td> 
     52                                <td> 
     53                                        <input id="${ id }_surname" class="editable disabledInput" disabled="true" value="${ entity.surname }" /> 
     54                                </td> 
     55                        </tr> 
     56                        <tr> 
     57                                <td class="label"> 
     58                                        <label for="${ id }_mail"> 
     59                                                Mail: 
     60                                        </label> 
     61                                </td> 
     62                                <td> 
     63                                        <input id="${ id }_mail" class="editable disabledInput" disabled="true" value="${ entity.mail }" /> 
     64                                </td> 
     65                        </tr> 
     66                        <tr> 
     67                                <td class="label"> 
     68                                        <label for="${ id }_mobile"> 
     69                                                Mobile: 
     70                                        </label> 
     71                                </td> 
     72                                <td> 
     73                                        <input id="${ id }_mobile" class="editable disabledInput" disabled="true" value="${ entity.mobile }" /> 
     74                                </td> 
     75                        </tr> 
     76                         
     77                        <c:if test="${ editable }">      
     78                        <tr class="controlRow"> 
     79                                <td class="label" />                     
     80                                <td> 
     81                                        <span id="${ id }_edit" class="toggleButton">Edit</span> 
     82                                        <span class="button excludedFromLayout submit"><a id="${ id }_apply">Apply</a></span>            
     83                                </td> 
     84                        </tr> 
     85                        </c:if> 
     86                         
     87                </table> 
     88                         
     89                <c:if test="${ infoOnly != true }"> 
     90                        <ul class="groupList">                   
     91                                <c:forEach items="${entity.ownedGroups}" var="group"> 
     92                                        <li id="${ group.UUID }"> 
     93                                                <span> 
     94                                                        <a href="${pageContext.request.contextPath}/group/${group.UUID}" > 
     95                                                                ${ group.name } 
     96                                                        </a> 
     97                                                </span>                          
     98                                                <span class="detailsButton"> 
     99                                                        <a href="#groupDetails"> 
     100                                                                <span class="faceboxButton">Details</span> 
     101                                                        </a> 
     102                                                </span> 
     103                                        </li>    
     104                                </c:forEach> 
     105                        </ul>                    
     106                                         
     107                        <ul class="groupList">                   
     108                                <c:forEach items="${entity.groups}" var="group"> 
     109                                        <li id="${ group.UUID }"> 
     110                                                <span> 
     111                                                        <a href="${pageContext.request.contextPath}/group/${group.UUID}" > 
     112                                                                ${ group.name } 
     113                                                        </a> 
     114                                                </span>                          
     115                                                <span class="detailsButton"> 
     116                                                        <a href="#groupDetails"> 
     117                                                                <span class="faceboxButton">Details</span> 
     118                                                        </a> 
     119                                                </span> 
     120                                        </li>    
     121                                </c:forEach> 
     122                        </ul> 
    84123                </c:if> 
    85         </table> 
    86124                 
    87         <c:if test="${ infoOnly != true }"> 
    88                 <ul class="groupList">                   
    89                         <c:forEach items="${entity.ownedGroups}" var="group"> 
    90                                 <li id="${ group.UUID }" class="label" > 
    91                                         <span> 
    92                                                 <a href="${pageContext.request.contextPath}/group/${group.UUID}" > 
    93                                                         ${ group.name } 
    94                                                 </a> 
    95                                         </span>                          
    96                                         <span> 
    97                                                 <input class="detailsButton" type="button" value="details" /> 
    98                                         </span> 
    99                                 </li>    
    100                         </c:forEach> 
    101                 </ul>                    
    102                                  
    103                 <ul class="groupList">                   
    104                         <c:forEach items="${entity.groups}" var="group"> 
    105                                 <li id="${ group.UUID }" class="label" > 
    106                                         <span> 
    107                                                 <a href="${pageContext.request.contextPath}/group/${group.UUID}" > 
    108                                                         ${ group.name } 
    109                                                 </a> 
    110                                         </span>                          
    111                                         <span> 
    112                                                 <input class="detailsButton" type="button" value="details" /> 
    113                                         </span> 
    114                                 </li>    
    115                         </c:forEach> 
    116                 </ul> 
    117         </c:if> 
    118          
    119 </form> 
     125        </form> 
     126</div> 
    120127