1 | package clarin.cmdi.componentregistry.common.components { |
---|
2 | import clarin.cmdi.componentregistry.services.Config; |
---|
3 | |
---|
4 | import com.adobe.net.URI; |
---|
5 | |
---|
6 | import flash.events.MouseEvent; |
---|
7 | import flash.net.URLRequest; |
---|
8 | import flash.net.navigateToURL; |
---|
9 | |
---|
10 | |
---|
11 | public class LoginLabelButton extends LabelButton { |
---|
12 | |
---|
13 | [Bindable] |
---|
14 | public var viewType:String; |
---|
15 | [Bindable] |
---|
16 | public var spaceType:String; |
---|
17 | [Bindable] |
---|
18 | public var itemId:String; |
---|
19 | |
---|
20 | public function LoginLabelButton() { |
---|
21 | super(handleLogin, "login"); |
---|
22 | toolTip = "Click to login"; |
---|
23 | } |
---|
24 | |
---|
25 | private function handleLogin(event:MouseEvent):void { |
---|
26 | var req:URLRequest = new URLRequest(); |
---|
27 | |
---|
28 | var uri:URI = new URI(Config.instance.serviceRootUrl); |
---|
29 | uri.setQueryValue("shhaaDo", "lI"); |
---|
30 | if (viewType) { |
---|
31 | uri.setQueryValue(Config.REGISTRY_PARAM_VIEW, viewType); |
---|
32 | } |
---|
33 | if (spaceType) { |
---|
34 | uri.setQueryValue(Config.REGISTRY_PARAM_SPACE, spaceType); |
---|
35 | } |
---|
36 | if (itemId) { |
---|
37 | uri.setQueryValue(Config.REGISTRY_PARAM_ITEM, itemId); |
---|
38 | } |
---|
39 | req.url = uri.toString(); |
---|
40 | navigateToURL(req, "_top"); |
---|
41 | } |
---|
42 | |
---|
43 | } |
---|
44 | } |
---|