<?php
include_once('c_ecp.php') ;
class c_page_cab_ecp_token extends c_page_cab_ecp
{
 public $h1='ЭЦП - токен' ;

 function block_main()
 { global $member ;
   //$this->panel_hand_TO() ;
   //$this->panel_list_TO() ;
     ?><script type="application/javascript" src="/class/ext/rutoken/libs/jquery/1.7.1/jquery.min.js"></script>
       <script type="application/javascript" src="/class/ext/rutoken/libs/jquery/1.7.1/jquery-base64.min.js"></script>
       <link rel="stylesheet" type="text/css" href="/class/ext/rutoken/libs/jqueryui/1.8.16/themes/black-tie/jquery-ui.css">
       <script type="application/javascript" src="/class/ext/rutoken/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>

       <link rel="stylesheet" type="text/css" href="/class/ext/rutoken/libs/syntaxhighligher/3.0.83/css/shCore.css">
       <link rel="stylesheet" type="text/css" href="/class/ext/rutoken/libs/syntaxhighligher/3.0.83/css/shThemeFadeToGrey.css">
       <script type="application/javascript" src="/class/ext/rutoken/libs/syntaxhighligher/3.0.83/js/shCore.js"></script>
       <script type="application/javascript" src="/class/ext/rutoken/libs/syntaxhighligher/3.0.83/js/shBrushJScript.js"></script>


       <link rel="stylesheet" type="text/css" href="/class/ext/rutoken/present.css">
       <script type="application/javascript" src="/class/ext/rutoken/present2.js"></script>
     <div id="container">
         <div id="content">
             <div class="test-common ui-widget-content ui-corner-all" id="ui-controls">
                 <div class="test-common">
                     <label for="device-list">Доступные устройства: </label>
                     <select id="device-list" class="item-list">
                         <option>Обновите список устройств</option>
                     </select>
                     <button id="refresh-dev" class="refresh-btn">↓↑</button>
                 </div>
                 <div class="test-common">
                     <label for="device-list">PIN-код:</label>
                     <input id="device-pin" value="12345678" size="15"/>
                     <button id="login">Войти</button>
                     <button id="logout">Выйти</button>
                     <button id="save-pin">Сохранить PIN</button>
                     <button id="remove-pin">Удалить PIN</button>
                 </div>
                 <div class="test-common">
                     <label for="key-list">Ключи на устройстве: </label>
                     <select id="key-list" class="item-list">
                         <option>Выполните вход на устройство</option>
                     </select>
                     <button id="refresh-keys" class="refresh-btn">↓↑</button>
                </div>
                 <div class="test-common">
                     <label for="cert-list">Сертификаты на уcтройстве: </label>
                     <select id="cert-list" class="item-list">
                         <option>Обновите список сертификатов</option>
                     </select>
                     <button id="refresh-certs" class="refresh-btn">↓↑</button>
                </div>
             </div>
         </div>
         <button id="test333">Проверка</button>
         <div id="console"></div>
         <object type="application/x-rutoken-pki" id="plugin-object" width="0" height="0"><param name="onload" value="onPluginLoaded"/></object>
         <!--<object type="application/x-rutoken-pki" id="plugin"></object>-->
         <script type="text/javascript">
         $j(document).ready(function()
         {  $j('button#test333').on('click',function()
            {   console.log('test333 click') ;
                // получение объекта плагина
                //var plugin = document.getElementById("plugin-object");
                //console.log(window.plugin.outerHTML) ;
                //if (!window.plugin.valid) {alert("Couldn't load plugin");}
                // использование асинхронного интерфейса
                //plugin.enumerateDevices
                plugin.pluginObject.enumerateDevices
                ( function(devices)
                  {console.log(devices);
                   console.log('enumerateDevices_success');
                  },
                  function(error)
                  { console.log(error);
                    console.log('enumerateDevices_error');
                  }
                );

                var keys = Array();

                try
                {
                  //  plugin.login(deviceId, "12345678");
                   // keys = plugin.enumerateKeys(deviceId, null);
                }
                catch (error)
                {
                    //console.log(error);
                }

            })



            console.log('document_ready') ;

         }) ;
         </script>

     </div>

   <?

 }



}

?>