Git Repository Public Repository

CPE_learningsite

URLs

Copy to Clipboard

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
				xmlns:components="com.adobe.sync.components.*" 
				layout="absolute" minWidth="200" minHeight="200" >
	
	<mx:Script>
		<![CDATA[
			import com.adobe.sync.events.SyncSwfEvent;
			
			import mx.controls.Alert;
			import mx.messaging.channels.StreamingAMFChannel;
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			import mx.utils.URLUtil;
			
			[Embed(source="assets/config.xml")]
			private var configXml:Class;

			[Bindable] public var version:String = "1.0.0";
			
			[Bindable] private var accountID:Number;
			[Bindable] private var roomSCO_ID:Number;
			[Bindable] private var roomFullUrl:String ="";
			[Bindable] private var roomHostUrl:String ="";
			[Bindable] private var roomUrl:String ="";
			[Bindable] private var currentUserID:Number;
			[Bindable] private var currentUserName:String;
			[Bindable] private var currentRole:String;
			private var commonInfo:XML;
			private var scoInfo:XML;
			
			[Bindable] private var baseServiceUrl:String;
			[Bindable] private var podId:Number;
			[Bindable] public var principalId:Number;
			[Bindable] public var accountId:Number;
			[Bindable] public var meetingFolderId:Number;
			[Bindable] public var host:String;
			[Bindable] public var adminHost:String;
			[Bindable] public var session:String;
			
			private function init() : void
			{
				loadSettings();
				
				currentUserID = syncConnector.userID;
				currentUserName = syncConnector.userName;
				currentRole = syncConnector.role;
				accountID = syncConnector.accountID;
				roomSCO_ID = syncConnector.roomSCOID;
				roomFullUrl = syncConnector.url;
				podId = syncConnector.podID;
				serviceCommonInfo.send();
				serviceGetSetting.send();
				roomHostUrl = URLUtil.getProtocol(roomFullUrl) + "://" +  URLUtil.getServerName(roomFullUrl);
				var url:String = roomFullUrl.replace(roomHostUrl, "");
				roomUrl = url.substring(0,url.lastIndexOf("/"));
			}	

			protected function commonInfo_resultHandler(event:ResultEvent):void
			{
				commonInfo = XML(event.result);
				principalId = Number(XML(commonInfo..user).attribute("user-id"));
				accountId = Number(XML(commonInfo..account).attribute("account-id"));
				host = commonInfo..host.toString().replace("http://", "").replace("https://", "");
				adminHost = commonInfo.descendants("admin-host");
				session = commonInfo..cookie;
				//Alert.show(commonInfo.toString());
			}
			
			private function loadSettings():void {
				var config:XML = configXml.data as XML;
				baseServiceUrl = config.descendants("ServiceUrl");
			}
			
			protected function getMeetingSettings_resultHandler(event:ResultEvent):void
			{
				var result:Object = event.result;
				var interval:String = result.Setting.Interval.toString();
				var text:String = result.Setting.Text == null ? "" : result.Setting.Text as String;
				txtInterval.text = interval;
				txtButtonText.text = text;		
			}
			
			protected function saveSettings():void{
				var url:String = baseServiceUrl + '/static/services/engagement/service.asmx/SetMeetingSettings?sco_id=' + roomSCO_ID.toString() + '&connectUrl=' + encodeURIComponent(roomHostUrl) + '&url=' + encodeURIComponent(roomUrl) + '&interval=' + txtInterval.text + '&text=' + encodeURIComponent(txtButtonText.text);
				var service:HTTPService = new HTTPService();
				service.url = url;
				service.contentType="application/x-www-form-urlencoded";
				service.resultFormat = "object";
				service.method = "POST";
				service.addEventListener(ResultEvent.RESULT, setMeetingSettings_resultHandler);
				service.addEventListener(FaultEvent.FAULT, service_faultHandler);
				service.send();
			}
			protected function setMeetingSettings_resultHandler(event:ResultEvent):void
			{
				var result:Object = event.result;
				var success:Boolean = result.ServiceStatus.Success as Boolean;
				if(success){
					Alert.show("Settings saved.");
					
				}
				else{
					Alert.show("Problem saving settings.");
				}
			}
			protected function service_faultHandler(event:FaultEvent):void{
				Alert.show("CPE Service Error:"+ event.fault.message, "Error");
				Alert.show(event.message.toString());
			}
			private function syncMessageReceived(p_evt:SyncSwfEvent):void
			{
			}
			
			protected function btnSave_clickHandler(event:MouseEvent):void
			{
				if(txtInterval.text.length > 0)
				{
					saveSettings();	
				}
				else{
					Alert.show("Please enter an interval.");
				}
					
			}
			
		]]>
	</mx:Script>
	

	
	<mx:VBox height="100%" width="100%" paddingTop="20" paddingLeft="10" paddingRight="10" paddingBottom="20">
		<mx:HBox width="100%">
			<mx:Label width="200" text="Polling interval in minutes"/>
			<mx:TextInput id="txtInterval" width="80" restrict="0-9" maxChars="4"/>
		</mx:HBox>
		<mx:HBox width="100%">
			<mx:Label width="200" text="Button Text"/>
			<mx:TextInput id="txtButtonText" width="80" maxChars="50" />
		</mx:HBox>
		<mx:HBox width="100%" horizontalAlign="left" >
			<mx:Button id="btnSave" label="Save" click="btnSave_clickHandler(event)"/>
		</mx:HBox>
	</mx:VBox>
	
	<components:SyncConnector id = "syncConnector" syncMessageReceived = "syncMessageReceived(event)" caughtUp="init()"/>
	<!-- Comment out the BreezeConnectionEmulator before loading the SWF in the Meeting client -->
	<!--	<ns1:ConnectionEmulator id = "connectionEmulator" bSyncConnector="{syncConnector}"/>
	-->	
	<mx:HTTPService id="serviceCommonInfo" resultFormat="xml" url="/api/xml?action=common-info" result="commonInfo_resultHandler(event)" />
	<mx:HTTPService id="serviceGetSetting" 
					resultFormat="object" 
					url="{baseServiceUrl + '/static/services/engagement/service.asmx/GetMeetingSettings?sco_id=' + roomSCO_ID.toString()}" 
					result="getMeetingSettings_resultHandler(event)" 
					method="POST"
					contentType="application/x-www-form-urlencoded" fault="service_faultHandler(event)"/>
</mx:Application>

Commits for CPE_learningsiteCPEFlex/EngagementAdminPod/src/EngagementAdminPod.mxml

Diff revisions: vs.
Revision Author Commited Message
4cd176 ... v.shishlov Fri 27 Aug, 2021 14:33:17 +0000

initial commit