src/it/ht/rcs/console/operations/view/agents/build/mobile/MobLocal.mxml
<?xml version="1.0" encoding="utf-8"?>
<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" width="100%" height="100%" xmlns:build="it.ht.rcs.console.operations.view.agents.build.*">
<fx:Script>
<![CDATA[
import it.ht.rcs.console.monitor.controller.LicenseManager;
import it.ht.rcs.console.operations.view.configuration.ConfigurationView;
import it.ht.rcs.console.task.controller.DownloadManager;
import it.ht.rcs.console.utils.AlertPopUp;
import locale.R;
import mx.core.UIComponent;
import mx.managers.PopUpManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
public var configView:ConfigurationView;
public function set platform(value:*):void {
if (value == 'blackberry' || value == 'ios')
currentState = value;
else
currentState = 'all';
if (value != null)
createBtn.platforms = [value];
}
protected function create():void
{
var params:Object;
if (currentState == 'blackberry') {
params = {platform: parentDocument.platform, binary: {demo: createBtn.demo.selected}, melt: {}, 'package': {type: 'local'} };
} else if (currentState == 'ios') {
params = {platform: parentDocument.platform, binary: {demo: createBtn.demo.selected}, melt: {}, 'package': {type: 'local'} };
}
params['factory'] = {_id: parentDocument.factory._id};
var filename:String = parentDocument.factory.name + "_" + parentDocument.platform + '_local.zip'
PopUpManager.removePopUp(((parentDocument as UIComponent).parentDocument).hostComponent);
DownloadManager.instance.createTask("build", filename, params, onSuccess, onFailure);
}
private function onSuccess(e:ResultEvent):void
{
PopUpManager.removePopUp(((parentDocument as UIComponent).parentDocument).hostComponent);
}
private function onFailure(e:FaultEvent):void
{
AlertPopUp.show(R.get('TASK_ALREADY_CREATED'));
}
]]>
</fx:Script>
<s:states>
<s:State name='all'/>
<s:State name='blackberry'/>
<s:State name='ios'/>
</s:states>
<s:TextArea includeIn="blackberry" left="10" top="20" right="0" height="83" borderVisible="false"
contentBackgroundAlpha="0.0" editable="false" text="{R.get('LOCAL_BLACKBERRY')}"/>
<s:TextArea includeIn="ios" left="10" top="20" right="0" height="83" borderVisible="false"
contentBackgroundAlpha="0.0" editable="false" text="{R.get('LOCAL_IOS')}"/>
<build:CreateWithDemoButton id="createBtn" left="10" bottom="0" right="10" create="{create}" configView="{configView}"/>
</s:Group>