Changeset 2423


Ignore:
Timestamp:
12/13/12 16:37:21 (11 years ago)
Author:
twagoo
Message:
  • Added OAuth2Service and added OAuth status components + action link to connect to ISOcat search pop-up component.
  • Minor adjustments to CSS
Location:
ComponentRegistry/branches/ComponentRegistry-oauth-1.13.0
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.13.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorManager.as

    r479 r2423  
    11package clarin.cmdi.componentregistry.editor {
    22        import clarin.cmdi.componentregistry.services.IsocatService;
     3        import clarin.cmdi.componentregistry.services.OAuth2Service;
    34
    45
     
    1617                        isocatSearchPopUp.searchService = new IsocatService();
    1718                        isocatSearchPopUp.isocatSearchType = isocatSearchType;
     19                        isocatSearchPopUp.oAuthService = new OAuth2Service();
    1820                        return isocatSearchPopUp;
    1921                }
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.13.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/IsocatSearchPopUp.mxml

    r2126 r2423  
    33                                xmlns:rictus="com.rictus.controls.*"
    44                                showCloseButton="true"
    5                                 creationComplete="PopUpManager.centerPopUp(this)"
     5                                creationComplete="onCreationComplete();"
    66                                close="cleanUp();"
    7                                 title="Search in Isocat.org">
    8 
     7                                title="Search in Isocat.org" xmlns:components="clarin.cmdi.componentregistry.common.components.*" xmlns:editor="clarin.cmdi.componentregistry.editor.*">
     8       
    99        <mx:Metadata>
    1010                [Event(name="OK", type="flash.events.Event")]
    1111        </mx:Metadata>
     12       
    1213        <mx:Script>
    1314                <![CDATA[
    1415                        import clarin.cmdi.componentregistry.services.IsocatService;
     16                        import clarin.cmdi.componentregistry.services.OAuth2Service;
    1517                       
    1618                        import mx.controls.TextInput;
    1719                        import mx.managers.PopUpManager;
    18 
     20                       
    1921                        public static const OK_EVENT:String = "OK";
    20 
     22                       
    2123                        [Bindable]
    2224                        public var searchService:IsocatService = null;
    23 
     25                        [Bindable]
     26                        public var oAuthService:OAuth2Service = null;
     27                       
    2428                        public var isocatSearchType:String = null;
    25 
     29                       
    2630                        //To store the result
    2731                        public var editField:TextInput;
    28 
     32                       
    2933                        private function handleOkClick():void {
    3034                                dispatchEvent(new Event(OK_EVENT));
    3135                                cleanUp();
    3236                        }
    33 
     37                       
    3438                        private function cleanUp():void {
    3539                                searchService.close();
    3640                                PopUpManager.removePopUp(this);
    3741                        }
    38 
     42                       
    3943                        private function initializeDataGrid():void {
    4044                                editField = new TextInput();
    4145                        }
    42 
     46                       
    4347                        private function setItem():void {
    4448                                var selectedItem:XML = dataGrid.selectedItem as XML;
     
    4852                                }
    4953                        }
    50 
     54                       
    5155                        private function handleSearch(event:Event):void {
    5256                                if(event is MouseEvent || (event is KeyboardEvent && KeyboardEvent(event).keyCode == Keyboard.ENTER)){
     
    5458                                }                               
    5559                        }
     60                       
     61                        protected function connectLink_clickHandler(event:MouseEvent):void
     62                        {
     63                                oAuthService.acquire();
     64                        }
     65                       
     66                        private function onCreationComplete():void {
     67                                PopUpManager.centerPopUp(this);
     68                                oAuthService.check();
     69                        }
    5670                ]]>
    5771        </mx:Script>
    58 
     72       
    5973        <mx:VBox>
    60                 <mx:HBox>
     74                <mx:HBox width="100%">
    6175                        <rictus:SearchBox id="searchBox"
    6276                                                          label="type keyword and press 'enter' to search"
     
    6781                                           click="handleSearch(event);" />
    6882                        <mx:Label text="{dataGrid.dataProvider.length} results"/>
     83                       
     84                        <mx:Spacer width="100%" />
     85                       
     86                        <mx:Label text="Checking ISOcat connection..." visible="{oAuthService.authentationState == OAuth2Service.AUTH_STATE_UNKNOWN}"
     87                                          includeInLayout="{oAuthService.authentationState == OAuth2Service.AUTH_STATE_UNKNOWN}"
     88                                          />
     89                        <mx:Label text="Connected to ISOcat" visible="{oAuthService.authentationState == OAuth2Service.AUTH_STATE_AUTHENTICATED}"
     90                                          includeInLayout="{oAuthService.authentationState == OAuth2Service.AUTH_STATE_AUTHENTICATED}"
     91                                          />
     92                        <editor:IsocatConnectLinkButton text="Connect to ISOcat" visible="{oAuthService.authentationState == OAuth2Service.AUTH_STATE_UNAUTHENTICATED}"
     93                                                                                        includeInLayout="{oAuthService.authentationState == OAuth2Service.AUTH_STATE_UNAUTHENTICATED}"
     94                                                                                        />
    6995                </mx:HBox>
    7096                <mx:DataGrid id="dataGrid"
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.13.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/Config.as

    r2278 r2423  
    4141                private static const USER_SETTINGS_URL:String = "/admin/userSettings";
    4242                private static const COMMENTS_URL_PATH:String = "/comments/";
    43                 private static const ISOCAT_SERVLET:String = "/isocat";
    44 
     43                private static const OAUTH_SERVLET:String = "/oauth2/connect";
     44                private static const OAUTH_CONNECT_SERVLET:String = OAUTH_SERVLET;
     45                private static const OAUTH_CHECK_SERVLET:String = OAUTH_SERVLET + "?acquire=false";
     46                private static const ISOCAT_SERVLET:String = "/oauth2/isocat";
    4547
    4648                private static var _instance:Config = new Config();
     
    133135                        return _serviceRootUrl + ISOCAT_SERVLET;
    134136                }
    135 
     137               
     138                public function get oAuth2CheckUrl():String {
     139                        return _serviceRootUrl + OAUTH_CHECK_SERVLET;
     140                }
     141               
     142                public function get oAuth2ConnectUrl():String {
     143                        return _serviceRootUrl + OAUTH_CONNECT_SERVLET;
     144                }
     145               
    136146                public function get serviceRootUrl():String {
    137147                        return _serviceRootUrl;
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.13.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/IsocatService.as

    r1591 r2423  
    1313
    1414        public class IsocatService extends EventDispatcher {
    15                 public static const PROFILE_LOADED:String = "ProfileLoaded";
    1615                public static const TYPE_SIMPLE:String = "simple";
    1716                public static const TYPE_COMPLEX:String = "complex";
     
    1918               
    2019                namespace dcif = "http://www.isocat.org/ns/dcif";
    21 
    2220
    2321                private var service:HTTPService;
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.13.0/ComponentRegistry/src/main/webapp/css/flexui.css

    r2422 r2423  
    2727        z-index: 100;
    2828       
    29         padding: 5px;
    30         background: #ccc;
     29        padding: 1em;
     30        padding-top: 2px;
     31        background: #ddd;
    3132}
    3233
Note: See TracChangeset for help on using the changeset viewer.