Changeset 5795 for ComponentRegistry


Ignore:
Timestamp:
11/11/14 16:13:39 (10 years ago)
Author:
Twan Goosen
Message:

Fixed issue that private profiles & components were requested when trying to switch from public space even if not logged in

Location:
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/SpaceSwitch.mxml

    r5699 r5795  
    11<?xml version="1.0" encoding="utf-8"?>
    22<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
    3                                  dataProvider="{spaces}"
    4                                  width="110"
    5                                  close="registrySpaceCloseHandler(event)"
    6                                  initialize="init()"
    7                                  change="onSelectionChanged(event)"
    8                                  >
     3                         width="110" change="selectionChangedHandler(event)"
     4                         dataProvider="{spaces}" initialize="init()">
    95       
    106        <mx:Script>
     
    1915                        import mx.collections.ArrayCollection;
    2016                        import mx.controls.Alert;
     17                        import mx.events.ListEvent;
    2118                       
    2219                        private static const PRIVATE_SPACE_LABEL:String = "Private space";
     
    2926                                spaces = new ArrayCollection([{label: PUBLIC_SPACE_LABEL, space: Config.SPACE_PUBLISHED, groupId:null}, {label: PRIVATE_SPACE_LABEL, space: Config.SPACE_PRIVATE, groupId:null}]);
    3027                        }
    31                        
    32                         private function onSelectionChanged(event:Event):void{
    33                                 var space:String = ComboBox(event.target).selectedItem.space;
    34                                 var groupId:String = ComboBox(event.target).selectedItem.groupId;
    35                                 if ((groupId != null) && (groupId != "")) {
    36                                         space = Config.SPACE_GROUP;
    37                                 }
    38                                 Config.instance.registrySpace = new RegistrySpace(space, groupId);
    39                         }
    40                        
    41                
    4228
    4329                        public function init():void{
    4430                                Config.instance.getListUserGroupsMembershipService().addEventListener(ListUserGroupsMembershipService.GROUPS_LOADED, onGroupsLoaded);
    4531                                Config.instance.getListUserGroupsMembershipService().loadGroupsForUser(); // triggers the event ListUserGroupsMembershipService.GROUPS_LOADED
     32                        }
     33                       
     34                        private function selectionChangedHandler(event:ListEvent):void {
     35                                if (Credentials.instance.isLoggedIn()) {
     36                                        var space:String = ComboBox(event.target).selectedItem.space;
     37                                        var groupId:String = ComboBox(event.target).selectedItem.groupId;
     38                                        if ((groupId != null) && (groupId != "")) {
     39                                                space = Config.SPACE_GROUP;
     40                                        }
     41                                        Config.instance.registrySpace = new RegistrySpace(space, groupId);
     42                                } else {
     43                                        event.stopPropagation();
     44                                        new Login().show(this.parent.parent, Config.VIEW_BROWSE, Config.instance.registrySpace.space, null);
     45                                        selectedIndex = 0;
    4646                                }
    47                        
    48                        
     47                        }
    4948                       
    5049                        public function onGroupsLoaded(event:Event):void{
     
    5554                                setSelectedIndex();
    5655                        }
    57                
    58                         private function registrySpaceCloseHandler(event:Event):void {
    59                                 if (Credentials.instance.isLoggedIn()) {
    60                                 } else {
    61                                         if (Config.instance.registrySpace.space != Config.SPACE_PUBLISHED) {
    62                                                 new Login().show(this.parent.parent, Config.VIEW_BROWSE, Config.instance.registrySpace.space, null);
    63                                                 //setSelectedIndex();
    64                                         }
    65                                        
    66                                 }
    67                         }
    6856                       
     57                        /**
     58                         * sets the index according to the current registry space
     59                         */
    6960                        public function setSelectedIndex():void{       
    7061                               
     
    7364                                        return;
    7465                                }
    75                                 if (Config.instance.registrySpace.space==Config.SPACE_PRIVATE) {
    76                                         this.selectedIndex = 1;
    77                                         return;
    78                                 }
    7966                               
    80                                 var index:int;
    81                                 if (Config.instance.registrySpace.space==Config.SPACE_GROUP) {
    82                                         for (index=2;index<spaces.length; index++) {
    83                                                 if (spaces[index].groupId==Config.instance.registrySpace.groupId){
    84                                                         trace("indeces:" + index+" " +Config.instance.registrySpace.groupId +" " +spaces[index].groupId);
    85                                                         this.selectedIndex = index;
    86                                                         return;
     67                                if(Credentials.instance.isLoggedIn()) {
     68                                        if (Config.instance.registrySpace.space==Config.SPACE_PRIVATE) {
     69                                                this.selectedIndex = 1;
     70                                                return;
     71                                        }
     72                                       
     73                                        var index:int;
     74                                        if (Config.instance.registrySpace.space==Config.SPACE_GROUP) {
     75                                                for (index=2;index<spaces.length; index++) {
     76                                                        if (spaces[index].groupId==Config.instance.registrySpace.groupId){
     77                                                                trace("indeces:" + index+" " +Config.instance.registrySpace.groupId +" " +spaces[index].groupId);
     78                                                                this.selectedIndex = index;
     79                                                                return;
     80                                                        }
    8781                                                }
    8882                                        }
     83                                       
     84                                        // in case of #$%^-up:                         
     85                                        var spacesDump:String= spaces[0].space + "; "+spaces[1].space;
     86                                        for (index=2;index<spaces.length; index++) {
     87                                                spacesDump=spacesDump+";  "+spaces[index].space + " " +spaces[index].groupId;
     88                                                }
     89                                       
     90                                        throw "Cannot identify the selection index for registry-space combobox. space = "+Config.instance.registrySpace.space+ " group "+Config.instance.registrySpace.groupId + spacesDump;
    8991                                }
    90                                
    91                                 // in case of #$%^-up:                         
    92                                 var spacesDump:String= spaces[0].space + "; "+spaces[1].space;
    93                                 for (index=2;index<spaces.length; index++) {
    94                                         spacesDump=spacesDump+";  "+spaces[index].space + " " +spaces[index].groupId;
    95                                         }
    96                                
    97                                 throw "Cannot indetify the selection index for registry-space combobox. space = "+Config.instance.registrySpace.space+ " group "+Config.instance.registrySpace.groupId + spacesDump;
    9892                        }
    9993                               
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentRegistryService.as

    r5699 r5795  
    3131                                throw "Registry space is lost."
    3232                        }
     33                        trace("Dispatching request to " + url.toDisplayString())
    3334                        super.dispatchRequest(url);
    3435                }
Note: See TracChangeset for help on using the changeset viewer.