blob: 5060c3f932b01c44dd4823258f51c31a9edfdf69 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
implements="com.flexcapacitor.views.IInspector"
width="100%"
minHeight="20"
>
<fx:Script>
<![CDATA[
import com.flexcapacitor.controller.Radiate;
import com.flexcapacitor.status.StatusManager;
import mx.events.ValidationResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.validators.EmailValidator;
[Bindable]
public var os:String;
[Bindable]
public var browser:String;
[Bindable]
public var player:String;
[Bindable]
public var manufacturer:String;
[Bindable]
public var cpu:String;
[Bindable]
public var isDebugger:Boolean;
[Bindable]
public var language:String;
[Bindable]
public var supports32bit:String;
[Bindable]
public var supports64bit:String;
[Bindable]
public var touchscreenType:String;
[Bindable]
public var isDebugSWF:Boolean;
[Bindable]
public var flexSDK:String;
private var radiate:Radiate = Radiate.instance;
public function activate():void {
radiate = Radiate.instance;
if (radiate.isUserLoggedIn) {
emailText.text = radiate.userEmail;
}
}
public function deactivate():void {
}
protected function getPropertiesInfo():void {
var cap:Object = Capabilities;
os = Capabilities.os;
manufacturer = Capabilities.manufacturer;
player = Capabilities.version;
isDebugger = Capabilities.isDebugger;
language = Capabilities.language;
// in the future we should load in the swf in question
// and get the sdk version and if its a debug swf
//flexSDK = mx_internal::Version;
isDebugSWF = false; //new Error().getStackTrace().search(/:[0-9]+]$/m) > -1;
if (Object(Capabilities).hasOwnProperty("cpuArchitecture")) {
cpu = Capabilities['cpuArchitecture'];
}
else {
cpu = "";
}
if (Object(Capabilities).hasOwnProperty("supports32BitProcesses")) {
supports32bit = Capabilities['supports32BitProcesses'];
supports64bit = Capabilities['supports64BitProcesses'];
}
else {
supports32bit = "";
supports64bit = "";
}
if (Object(Capabilities).hasOwnProperty("touchscreenType")) {
touchscreenType = Capabilities['touchscreenType'];
}
else {
touchscreenType = "";
}
if (ExternalInterface.available) {
browser = ExternalInterface.call("eval", "navigator.userAgent");
}
else {
browser = Capabilities.playerType;
}
}
protected function featureRadioGroup_changeHandler(event:Event):void {
if (featureRadioButton.selected) {
currentState = "feature";
}
else {
currentState = "bug";
}
}
protected function sendButton_clickHandler(event:MouseEvent):void {
var message:Object = new Object();
var validResultEvent:ValidationResultEvent = emailValidator.validate(emailText.text);
//var validEmail:Boolean = emailValidator.validate(emailText.text);
if (emailText.text=="" && validResultEvent.results.length==0) {
StatusManager.show("Please enter your email before sending a message.");
return;
}
if (messageTextArea.text=="") {
StatusManager.show("Please enter a message.");
return;
}
message.os = os;
message.browser = browser;
message.player = player;
message.manufacturer = manufacturer;
message.cpu = cpu;
message.isDebugger = isDebugger;
message.language = language;
message.supports32bit = supports32bit;
message.supports64bit = supports64bit;
message.touchscreen = touchscreenType;
//message.name = nameText.text;
message.email = emailText.text=="" ? emailText.prompt : emailText.text;
message.message = messageTextArea.text;
feedbackService.send(message);
}
protected function feedbackService_resultHandler(event:ResultEvent):void {
var result:String = event.result as String;
StatusManager.show("Message sent!");
//nameText.text = "";
emailText.prompt = emailText.text!="" ? emailText.text : emailText.prompt;
emailText.text = "";
messageTextArea.text = "";
}
protected function feedbackService_faultHandler(event:FaultEvent):void {
StatusManager.show("An error occurred! Message may not have been sent. Please email contact@radii8.com.", 6000);
//StatusManager.show("An error occurred! Message may not have been sent. \n\n" + event.fault.message);
Radiate.log.error(event.fault.message);
}
]]>
</fx:Script>
<fx:Declarations>
<mx:EmailValidator id="emailValidator" />
<s:RadioButtonGroup id="featureRadioGroup"
change="featureRadioGroup_changeHandler(event)"/>
<s:HTTPService id="feedbackService"
method="POST"
fault="feedbackService_faultHandler(event)"
result="feedbackService_resultHandler(event)"
url="http://www.radii8.com/support.php"/>
</fx:Declarations>
<s:states>
<s:State name="feature"/>
<s:State name="bug"/>
</s:states>
<s:VGroup left="0" right="0"
top="0"
width="100%"
height="100%"
clipAndEnableScrolling="true"
paddingLeft="10"
paddingRight="10"
paddingBottom="10"
>
<s:HGroup left="0" right="0"
width="100%"
clipAndEnableScrolling="true"
paddingRight="10"
verticalAlign="middle"
>
<s:Label text="Send as many feature request and bug reports as you like."/>
<s:Spacer width="100%"/>
<s:RadioButton id="featureRadioButton"
label="Feature"
group="{featureRadioGroup}"
selected="true"
/>
<s:RadioButton id="booleanDisabledRadioButton"
label="Bug"
group="{featureRadioGroup}"
/>
<s:Button id="sendButton"
label="Send"
click="sendButton_clickHandler(event)"
/>
</s:HGroup>
<s:HGroup verticalAlign="middle">
<s:Label text="Your email:"/>
<s:TextInput id="emailText"
minWidth="250"
focusAlpha="0"
borderColor="#cccccc"
/>
</s:HGroup>
<s:HGroup left="0" right="0"
width="100%" height="100%"
clipAndEnableScrolling="true"
paddingRight="10"
verticalAlign="middle"
>
<s:TextArea id="messageTextArea"
focusColor="#585858"
focusAlpha="0"
width="50%" height="100%"
borderColor="#cccccc"
paddingTop="8"
paddingBottom="8"
prompt.feature="Enter your feature and click send"
>
<s:keyFocusChange>
event.preventDefault();
event.currentTarget.insertText("\t");
</s:keyFocusChange>
<s:prompt.bug>Summarize the problem and list the steps to reproduce.</s:prompt.bug>
<s:text.bug>
<![CDATA[Summary:
Steps to reproduce:
1.
2.
3.
Expected Result:
Actual Result:
]]></s:text.bug>
</s:TextArea>
<s:TextArea id="helpTextArea"
focusColor="#585858"
focusAlpha="0"
width="50%" height="100%"
borderColor="#cccccc"
borderVisible="false"
paddingTop="8"
paddingBottom="8"
editable="false"
includeIn="bug"
fontStyle="italic"
color="#585858"
>
<s:text><![CDATA[Summarize the problem and list the steps to reproduce.
Steps to reproduce:
1. Add a button to the stage
2. Set color on the button to red in the properties panel
Expected Result:
Button text is red
Actual Result:
Button text is blue]]></s:text>
</s:TextArea>
</s:HGroup>
</s:VGroup>
</s:Group>