hackedteam/rcs-console

View on GitHub
src/it/ht/rcs/console/accounting/view/users/PrivsRenderer.mxml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer 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="65" height="15" focusEnabled="true">
  
  <fx:Script>
    <![CDATA[
      
      import locale.R
      
      [Bindable]
      private var _admin:Boolean;
      [Bindable]
      private var _tech:Boolean;
          [Bindable]
          private var _sys:Boolean;
          [Bindable]
      private var _view:Boolean;
      
      public function set data(o:Object):void {
                   
          _admin = false;
          _sys = false;
          _tech = false;
          _view = false;
          
          if (o.source.indexOf('admin') != -1 || o.source.indexOf('ADMIN') != -1)
            _admin = true;

              if (o.source.indexOf('sys') != -1 || o.source.indexOf('SYS') != -1)
                  _sys = true;
          
          if (o.source.indexOf('tech') != -1 || o.source.indexOf('TECH') != -1)
            _tech = true;
          
          if (o.source.indexOf('view') != -1 || o.source.indexOf('VIEW') != -1)
            _view = true;
      }
      
    ]]>
  </fx:Script>
  
  <s:Image left="5"  top="0" bottom="0" source="@Embed('img/privs/admin.png')" visible="{_admin}" toolTip="{R.get('ADMIN_DESC')}"/>
  <s:Image left="25" top="0" bottom="0" source="@Embed('img/privs/sys.png')"   visible="{_sys}" toolTip="{R.get('SYS_DESC')}"/>
  <s:Image left="45" top="0" bottom="0" source="@Embed('img/privs/tech.png')"  visible="{_tech}" toolTip="{R.get('TECH_DESC')}"/>
  <s:Image left="65" top="0" bottom="0" source="@Embed('img/privs/view.png')"  visible="{_view}" toolTip="{R.get('VIEW_DESC')}"/>

</s:SkinnableContainer>