Commit c987c66d148a692c20191fb8b0b7a881d513c60b
1 parent
1184271c
Exists in
master
and in
1 other branch
Nova operação de atualização de subredes
Showing
3 changed files
with
527 additions
and
2 deletions
Show diff stats
src/Cacic/CommonBundle/Controller/RedeController.php
@@ -13,6 +13,7 @@ use Cacic\WSBundle\Helper; | @@ -13,6 +13,7 @@ use Cacic\WSBundle\Helper; | ||
13 | use Cacic\CommonBundle\Helper as CacicHelper; | 13 | use Cacic\CommonBundle\Helper as CacicHelper; |
14 | use Ijanki\Bundle\FtpBundle\Exception\FtpException; | 14 | use Ijanki\Bundle\FtpBundle\Exception\FtpException; |
15 | use Symfony\Component\Validator\Constraints\Null; | 15 | use Symfony\Component\Validator\Constraints\Null; |
16 | +use Symfony\Component\Finder\Finder; | ||
16 | 17 | ||
17 | /** | 18 | /** |
18 | * | 19 | * |
@@ -490,6 +491,8 @@ class RedeController extends Controller | @@ -490,6 +491,8 @@ class RedeController extends Controller | ||
490 | $em->persist($redeVersaoModulo); | 491 | $em->persist($redeVersaoModulo); |
491 | $em->flush(); | 492 | $em->flush(); |
492 | 493 | ||
494 | + } else { | ||
495 | + $logger->error("Erro no envio do módulo via FTP \n".$arrResult[1]); | ||
493 | } | 496 | } |
494 | 497 | ||
495 | //echo $_GET['pIntIdRede'] . '_=_' . $_GET['pStrNmItem'] . '_=_' . $strResult; | 498 | //echo $_GET['pIntIdRede'] . '_=_' . $_GET['pStrNmItem'] . '_=_' . $strResult; |
@@ -540,7 +543,7 @@ class RedeController extends Controller | @@ -540,7 +543,7 @@ class RedeController extends Controller | ||
540 | $logger->debug("Enviando módulo $pStrFullItemName para o servidor $pStrTeServer na pasta $pStrTePathServer"); | 543 | $logger->debug("Enviando módulo $pStrFullItemName para o servidor $pStrTeServer na pasta $pStrTePathServer"); |
541 | 544 | ||
542 | 545 | ||
543 | - $conn = $ftp->connect($pStrTeServer); | 546 | + $conn = $ftp->connect($pStrTeServer, $pStrNuPortaServer); |
544 | // Retorno esperado....: 230 => FTP_USER_LOGGED_IN | 547 | // Retorno esperado....: 230 => FTP_USER_LOGGED_IN |
545 | // Retorno NÃO esperado: 530 => FTP_USER_NOT_LOGGED_IN | 548 | // Retorno NÃO esperado: 530 => FTP_USER_NOT_LOGGED_IN |
546 | 549 | ||
@@ -669,4 +672,327 @@ class RedeController extends Controller | @@ -669,4 +672,327 @@ class RedeController extends Controller | ||
669 | ) | 672 | ) |
670 | ); | 673 | ); |
671 | } | 674 | } |
675 | + | ||
676 | + /** | ||
677 | + * Função nova para atualização das subredes | ||
678 | + * | ||
679 | + * @param Request $request | ||
680 | + * @return Response | ||
681 | + */ | ||
682 | + public function manutencaoNeoAction(Request $request) | ||
683 | + { | ||
684 | + $logger = $this->get('logger'); | ||
685 | + | ||
686 | + // Primeiro carrega lista dos módulos | ||
687 | + $modulos = $this->modulosNeoArray($request); | ||
688 | + | ||
689 | + | ||
690 | + if ( $request->isMethod('POST') ) | ||
691 | + { | ||
692 | + if ( count( $request->get('subrede') ) ) | ||
693 | + { | ||
694 | + $retorno = true; | ||
695 | + foreach ( $request->get('subrede') as $resultado ) | ||
696 | + { | ||
697 | + $logger->debug("Atualizando a subrede {$resultado} ..."); | ||
698 | + | ||
699 | + // Junta os módulos windows e linux para enviar para o update de subredes | ||
700 | + $atualizaWindows = $request->get('windows'); | ||
701 | + $atualizaLinux = $request->get('linux'); | ||
702 | + | ||
703 | + // FIXME: Na requisição só vem o nome dos módulos. Precisa carregar as outras informações. | ||
704 | + | ||
705 | + // Evita Warning do array merge se um dos dois for vazio | ||
706 | + if (empty($atualizaLinux)) { | ||
707 | + $atualiza = $atualizaWindows; | ||
708 | + } elseif (empty($atualizaWindows)) { | ||
709 | + $atualiza = $atualizaLinux; | ||
710 | + } else { | ||
711 | + $atualiza = array_merge($atualizaWindows, $atualizaLinux); | ||
712 | + } | ||
713 | + | ||
714 | + // Passa a rede como parâmetro | ||
715 | + $redeAtualizar = $this->getDoctrine()->getManager()->find('CacicCommonBundle:Rede', $resultado); | ||
716 | + | ||
717 | + | ||
718 | + // Executa a atualização de todos os módulos marcados para a subrede marcada | ||
719 | + $result = $this->updateSubredesNeo($request, $redeAtualizar, $atualiza); | ||
720 | + if (!$result) { | ||
721 | + $retorno = $result; | ||
722 | + } | ||
723 | + } | ||
724 | + if ($retorno) { | ||
725 | + $this->get('session')->getFlashBag()->add('success', 'Dados salvos com sucesso!'); | ||
726 | + } else { | ||
727 | + $this->get('session')->getFlashBag()->add('error', 'Erro na atualização das subredes'); | ||
728 | + } | ||
729 | + | ||
730 | + } | ||
731 | + } | ||
732 | + | ||
733 | + // Lista de subredes e módulos | ||
734 | + $subredesOrig = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->comLocal(); | ||
735 | + | ||
736 | + // Varro todas as subredes para cada módulo | ||
737 | + $subredes = array(); | ||
738 | + $windows = array(); | ||
739 | + $linux = array(); | ||
740 | + foreach ($subredesOrig as $redeItem) { | ||
741 | + // Busca o módulo em cada uma das redes | ||
742 | + $codigos = array(); | ||
743 | + foreach ($modulos as $key => $value) { | ||
744 | + $idRede = $redeItem['idRede']; | ||
745 | + // Verifico se o módulo existe na subrede | ||
746 | + $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:RedeVersaoModulo')->subrede($idRede, $key); | ||
747 | + | ||
748 | + if (empty($rede)) { | ||
749 | + // O módulo não foi encontrado. Adiciona o código 1 | ||
750 | + array_push($codigos, 0); | ||
751 | + //$rede = $redeItem[0]; | ||
752 | + } else { | ||
753 | + if ($value['hash'] == $rede[0]['teHash']) { | ||
754 | + // Se o hash for igual, adiciona o código 2 | ||
755 | + array_push($codigos, 2); | ||
756 | + | ||
757 | + } else { | ||
758 | + // Se o hash for diferente, adiciona o código 1 | ||
759 | + array_push($codigos, 1); | ||
760 | + } | ||
761 | + } | ||
762 | + | ||
763 | + // Cria um array para Windows e outro para Linux | ||
764 | + if ($value['tipoSo'] == 'windows') { | ||
765 | + $windows[$key] = $value; | ||
766 | + } else { | ||
767 | + $linux[$key] = $value; | ||
768 | + } | ||
769 | + | ||
770 | + } | ||
771 | + | ||
772 | + // Define o elemento HTML para os módulos | ||
773 | + if (in_array(0, $codigos)) { | ||
774 | + // Se o código 0 for encontrato, marcamos o módulo como inexistente | ||
775 | + if (empty($rede)) { | ||
776 | + $rede[0] = $redeItem; | ||
777 | + } | ||
778 | + $subredes["$idRede"]['teIpRede'] = $rede[0]['teIpRede']; | ||
779 | + $subredes["$idRede"]['nmRede'] = $rede[0]['nmRede']; | ||
780 | + $subredes["$idRede"]['teServUpdates'] = $rede[0]['teServUpdates']; | ||
781 | + $subredes["$idRede"]['tePathServUpdates'] = $rede[0]['tePathServUpdates']; | ||
782 | + $subredes["$idRede"]['nmLocal'] = $rede[0]['nmLocal']; | ||
783 | + $subredes["$idRede"]['codigo'] = "<span class='label label-important'>Módulos inexistentes</span>"; | ||
784 | + } elseif (in_array(1, $codigos)) { | ||
785 | + // Se o código 1 for encontrado, alguns módulos estão desatualizados | ||
786 | + $subredes["$idRede"]['teIpRede'] = $rede[0]['teIpRede']; | ||
787 | + $subredes["$idRede"]['nmRede'] = $rede[0]['nmRede']; | ||
788 | + $subredes["$idRede"]['teServUpdates'] = $rede[0]['teServUpdates']; | ||
789 | + $subredes["$idRede"]['tePathServUpdates'] = $rede[0]['tePathServUpdates']; | ||
790 | + $subredes["$idRede"]['nmLocal'] = $rede[0]['nmLocal']; | ||
791 | + $subredes["$idRede"]['codigo'] = "<span class='label label-warning'>Módulos desatualizados</span>"; | ||
792 | + } else { | ||
793 | + // Se não existe nenhum módulo inexistente ou desatualizado, está tudo 100% atualizado | ||
794 | + $subredes["$idRede"]['teIpRede'] = $rede[0]['teIpRede']; | ||
795 | + $subredes["$idRede"]['nmRede'] = $rede[0]['nmRede']; | ||
796 | + $subredes["$idRede"]['teServUpdates'] = $rede[0]['teServUpdates']; | ||
797 | + $subredes["$idRede"]['tePathServUpdates'] = $rede[0]['tePathServUpdates']; | ||
798 | + $subredes["$idRede"]['nmLocal'] = $rede[0]['nmLocal']; | ||
799 | + $subredes["$idRede"]['codigo'] = "<span class='label label-success'>Módulos atualizados</span>"; | ||
800 | + } | ||
801 | + } | ||
802 | + | ||
803 | + return $this->render( 'CacicCommonBundle:Rede:manutencaoNeo.html.twig', | ||
804 | + array( | ||
805 | + 'windows'=> $windows, | ||
806 | + 'linux' => $linux, | ||
807 | + 'subredes' => $subredes | ||
808 | + ) | ||
809 | + ); | ||
810 | + | ||
811 | + } | ||
812 | + | ||
813 | + /* | ||
814 | + * Função que retorna um array multidimensional com o nome dos executáveis, | ||
815 | + * o hash e versão constantes do arquivo versions_and_hashes.ini | ||
816 | + * | ||
817 | + * @param nmModulo Nome do módulo para trazer informações | ||
818 | + * | ||
819 | + * @return Array multidimensional com os dados | ||
820 | + */ | ||
821 | + | ||
822 | + public function modulosNeoArray(Request $request, $nmModulos = null) | ||
823 | + { | ||
824 | + $logger = $this->get('logger'); | ||
825 | + // Abre e faz o parsing do arquivo | ||
826 | + $cacic_helper = new Helper\OldCacicHelper($this->container->get('kernel')); | ||
827 | + $iniFile = $cacic_helper->iniFile(); | ||
828 | + $itemArray = parse_ini_file($iniFile); | ||
829 | + $teste = parse_ini_file($iniFile, true); | ||
830 | + | ||
831 | + // Varre o diretório em busca dos módulos | ||
832 | + $rootDir = $this->container->get('kernel')->getRootDir(); | ||
833 | + $webDir = $rootDir . "/../web/"; | ||
834 | + $downloadsDir = $webDir . "downloads/"; | ||
835 | + $cacicDir = $downloadsDir . "cacic/"; | ||
836 | + $linuxDir = $cacicDir . "linux/"; | ||
837 | + $windowsDir = $cacicDir . "windows/"; | ||
838 | + $outrosDir = $downloadsDir . "outros/"; | ||
839 | + | ||
840 | + // Constrói array de arquivos e hashes | ||
841 | + $finder = new Finder(); | ||
842 | + $agentes = new Finder(); | ||
843 | + $saida = array(); | ||
844 | + $base_url = $request->getBaseUrl(); | ||
845 | + $base_url = preg_replace('/\/app.*.php/', "/", $base_url); | ||
846 | + | ||
847 | + // Primeiro tratamos agentes Linux | ||
848 | + // A regra é que o agente mais atual estará na pasta current | ||
849 | + $current = basename(readlink($linuxDir."current")); | ||
850 | + $finder->directories()->in($linuxDir); | ||
851 | + foreach($finder as $version) { | ||
852 | + if ($version->getFileName() == 'current') { | ||
853 | + // Aqui considera somente a última versão | ||
854 | + $agentes->files()->in($version->getRealPath()); | ||
855 | + foreach ($agentes as $file) { | ||
856 | + if (!empty($nmModulos)) { | ||
857 | + // Filtra por nome de módulo | ||
858 | + if (!in_array($file->getFileName(), $nmModulos)) { | ||
859 | + continue; | ||
860 | + } | ||
861 | + } | ||
862 | + $saida[$file->getFileName()] = array( | ||
863 | + 'name' => $file->getFileName(), | ||
864 | + 'versao' => $current, | ||
865 | + 'download_url' => $base_url . 'downloads/cacic/linux/' . $version->getFileName() . '/' . $file->getFileName(), | ||
866 | + 'hash' => md5_file($file->getRealPath()), | ||
867 | + 'size' => $file->getSize(), | ||
868 | + 'filename' => 'cacic/linux/' . $version->getFileName() . '/' . $file->getFileName(), | ||
869 | + 'tipoSo' => 'linux' | ||
870 | + ); | ||
871 | + } | ||
872 | + } else { | ||
873 | + continue; | ||
874 | + } | ||
875 | + | ||
876 | + } | ||
877 | + // Get latest version | ||
878 | + //$current = basename(readlink($cacicDir."current")); | ||
879 | + //$saida['linux']['live_version'] = $current; | ||
880 | + | ||
881 | + // Aí tratamos Windows | ||
882 | + $finder->directories()->in($windowsDir); | ||
883 | + $current = basename(readlink($windowsDir."current")); | ||
884 | + foreach($finder as $version) { | ||
885 | + if ($version->getFileName() == 'current') { | ||
886 | + // Aqui considera somente a última versão | ||
887 | + $agentes->files()->in($version->getRealPath()); | ||
888 | + foreach ($agentes as $file) { | ||
889 | + if (!empty($nmModulos)) { | ||
890 | + // Filtra por nome de módulo | ||
891 | + if (!in_array($file->getFileName(), $nmModulos)) { | ||
892 | + continue; | ||
893 | + } | ||
894 | + } | ||
895 | + $saida[$file->getFileName()] = array( | ||
896 | + 'name' => $file->getFileName(), | ||
897 | + 'versao' => $current, | ||
898 | + 'download_url' => $base_url . 'downloads/cacic/windows/' . $version->getFileName() . '/' . $file->getFileName(), | ||
899 | + 'hash' => md5_file($file->getRealPath()), | ||
900 | + 'size' => $file->getSize(), | ||
901 | + 'filename' => 'cacic/windows/' . $version->getFileName() . '/' . $file->getFileName(), | ||
902 | + 'tipoSo' => 'windows' | ||
903 | + ); | ||
904 | + } | ||
905 | + } else { | ||
906 | + continue; | ||
907 | + } | ||
908 | + | ||
909 | + } | ||
910 | + // Get latest version | ||
911 | + //$current = basename(readlink($windowsDir."current")); | ||
912 | + //$saida['windows']['live_version'] = $current; | ||
913 | + | ||
914 | + // Retorna o array com todos os resultados | ||
915 | + return $saida; | ||
916 | + } | ||
917 | + | ||
918 | + public function updateSubredesNeo(Request $request, $rede, $modulos = null) | ||
919 | + { | ||
920 | + $logger = $this->get('logger'); | ||
921 | + $pIntIdRede = $rede->getIdRede(); | ||
922 | + | ||
923 | + // Varre o diretório em busca dos módulos | ||
924 | + $rootDir = $this->container->get('kernel')->getRootDir(); | ||
925 | + $webDir = $rootDir . "/../web/"; | ||
926 | + $downloadsDir = $webDir . "downloads/"; | ||
927 | + $cacicDir = $downloadsDir . "cacic/"; | ||
928 | + $linuxDir = $cacicDir . "linux/"; | ||
929 | + $windowsDir = $cacicDir . "windows/"; | ||
930 | + $outrosDir = $downloadsDir . "outros/"; | ||
931 | + | ||
932 | + // Carrega todos os metadados dos módulos fornecidos ou de todos os módulos | ||
933 | + $modulos = $this->modulosNeoArray($request, $modulos); | ||
934 | + $logger->debug("6666666666666666666666666666666666666 ".print_r($modulos, true)); | ||
935 | + | ||
936 | + foreach ($modulos as $key => $value) | ||
937 | + { | ||
938 | + $logger->debug("Nome do módulo: $key"); | ||
939 | + | ||
940 | + // Carrega dados da rede | ||
941 | + $em = $this->getDoctrine()->getManager(); | ||
942 | + //$arrDadosRede = array( 'rede' => $em->getRepository( 'CacicCommonBundle:Rede' )->listar() ); | ||
943 | + //Debug::dump($arrDadosRede['rede'][0][0]); | ||
944 | + //$arrDadosRede = $arrDadosRede['rede'][0]; | ||
945 | + $arrDadosRede = array( | ||
946 | + 'teServUpdates' => $rede->getTeServUpdates(), | ||
947 | + 'tePathServUpdates' => $rede->getTePathServUpdates(), | ||
948 | + 'nmUsuarioLoginServUpdatesGerente' => $rede->getNmUsuarioLoginServUpdatesGerente(), | ||
949 | + 'teSenhaLoginServUpdatesGerente' => $rede->getTeSenhaLoginServUpdatesGerente(), | ||
950 | + 'nuPortaServUpdates' => $rede->getNuPortaServUpdates(), | ||
951 | + ); | ||
952 | + | ||
953 | + $strResult = $this->checkAndSend( | ||
954 | + $value['name'], | ||
955 | + $downloadsDir . $value['filename'], | ||
956 | + $arrDadosRede['teServUpdates'], | ||
957 | + $arrDadosRede['tePathServUpdates'], | ||
958 | + $arrDadosRede['nmUsuarioLoginServUpdatesGerente'], | ||
959 | + $arrDadosRede['teSenhaLoginServUpdatesGerente'], | ||
960 | + $arrDadosRede['nuPortaServUpdates'] | ||
961 | + ); | ||
962 | + | ||
963 | + $arrResult = explode('_=_',$strResult); | ||
964 | + | ||
965 | + if ($arrResult[1] == 'Ok!') | ||
966 | + { | ||
967 | + // Consertar CRUD no Symfony | ||
968 | + $redeVersaoModulo = $em->getRepository('CacicCommonBundle:RedeVersaoModulo')->findOneBy( | ||
969 | + array( | ||
970 | + 'idRede' => $pIntIdRede, | ||
971 | + 'nmModulo' => $value['name'] | ||
972 | + ) | ||
973 | + ); | ||
974 | + | ||
975 | + // Se não existir, instancia o objeto | ||
976 | + if (empty($redeVersaoModulo)) { | ||
977 | + $redeVersaoModulo = new RedeVersaoModulo(null, null, null, null, null, $rede); | ||
978 | + } | ||
979 | + | ||
980 | + // Adicione o restante dos atributos | ||
981 | + $redeVersaoModulo->setNmModulo($value['name']); | ||
982 | + $redeVersaoModulo->setTeVersaoModulo($value['versao']); | ||
983 | + $redeVersaoModulo->setDtAtualizacao(new \DateTime('NOW')); | ||
984 | + $redeVersaoModulo->setCsTipoSo( $value['tipoSo'] ); | ||
985 | + $redeVersaoModulo->setTeHash($value['hash']); | ||
986 | + | ||
987 | + $em->persist($redeVersaoModulo); | ||
988 | + $em->flush(); | ||
989 | + } else { | ||
990 | + $logger->error("Erro no envio dos módulos via FTP!\n".$arrResult[1]); | ||
991 | + return false; | ||
992 | + } | ||
993 | + } | ||
994 | + | ||
995 | + return true; | ||
996 | + } | ||
997 | + | ||
672 | } | 998 | } |
673 | \ No newline at end of file | 999 | \ No newline at end of file |
src/Cacic/CommonBundle/Resources/config/routing.yml
@@ -549,4 +549,8 @@ cacic_agente_excluir: | @@ -549,4 +549,8 @@ cacic_agente_excluir: | ||
549 | 549 | ||
550 | cacic_deploy: | 550 | cacic_deploy: |
551 | pattern: /admin/deploy/ | 551 | pattern: /admin/deploy/ |
552 | - defaults: { _controller: CacicCommonBundle:Agente:deploy } | ||
553 | \ No newline at end of file | 552 | \ No newline at end of file |
553 | + defaults: { _controller: CacicCommonBundle:Agente:deploy } | ||
554 | + | ||
555 | +cacic_atualizacao_subredes: | ||
556 | + pattern: /admin/subrede/manutencaoneo | ||
557 | + defaults: { _controller: CacicCommonBundle:Rede:manutencaoNeo } | ||
554 | \ No newline at end of file | 558 | \ No newline at end of file |
src/Cacic/CommonBundle/Resources/views/Rede/manutencaoNeo.html.twig
0 → 100644
@@ -0,0 +1,195 @@ | @@ -0,0 +1,195 @@ | ||
1 | +{% extends 'CacicCommonBundle::base.html.twig' %} | ||
2 | + | ||
3 | +{% block breadcrumb %} | ||
4 | +<li class="active">{{ 'Atualizacoes de subredes'|trans }}</li> | ||
5 | +{% endblock %} | ||
6 | + | ||
7 | +{% block body %} | ||
8 | + | ||
9 | +<div class="row-fluid"> | ||
10 | + <div class="span12"> | ||
11 | + | ||
12 | + <div class="box grad_colour_black"> | ||
13 | + | ||
14 | + <h2 class="box_head round_top"><i class="icon-hdd"></i> {{ 'Atualizações de subredes'|trans }}</h2> | ||
15 | + | ||
16 | + <div class="block box_content round_bottom padding_10"> | ||
17 | + | ||
18 | + <h3>{{ 'Conteúdo do repositório'|trans }}</h3> | ||
19 | + <p>{{ 'As informações referem-se aos objetos constantes do repositório, os quais poderão ser assinalados para verificação de existência e/ou versões nas SubRedes cadastradas'|trans }}.</p> | ||
20 | + <br /> | ||
21 | + | ||
22 | + <form id={{ 'formSoftwaresNaoUsados'|trans }} class="form-horizontal" action="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}" method="post"> | ||
23 | + <h4 align="center">{{ "Agentes para MS-Windows"|trans }}</h4> | ||
24 | + <table class="table table-striped table-bordered"> | ||
25 | + <thead> | ||
26 | + <tr> | ||
27 | + <th width="40%" style="text-align: center">{{ 'Arquivo'|trans }}</th> | ||
28 | + <th width="20%" style="text-align: center">{{ 'Versão'|trans }}</th> | ||
29 | + <th width="40%" style="text-align: center">{{ 'Hash'|trans }}</th> | ||
30 | + <th style="text-align: center"> | ||
31 | + <label style="margin: auto; width:12px; height:10px;"> | ||
32 | + <input type="checkbox" class="toggleCheck" name="toggleCheck[]" value="windows" checked> | ||
33 | + </label> | ||
34 | + </th> | ||
35 | + </tr> | ||
36 | + </thead> | ||
37 | + <tbody> | ||
38 | + | ||
39 | + {% for key, modulo in windows %} | ||
40 | + | ||
41 | + <tr id="item_{{ key }}"> | ||
42 | + <td style="text-align: center" id="item_desc_{{ key }}">{{ key }}</td> | ||
43 | + <td style="text-align: center" >{{ modulo['versao'] }}</td> | ||
44 | + <td style="text-align: center" >{{ modulo['hash'] }}</td> | ||
45 | + <td> | ||
46 | + <label style="margin: auto; width:12px; height:10px;"> | ||
47 | + <input type="checkbox" id="item_id_{{ key }}" name="windows[]" value="{{ key }}" checked> | ||
48 | + </label> | ||
49 | + </td> | ||
50 | + </tr> | ||
51 | + {% else %} | ||
52 | + <tr> | ||
53 | + <td style="text-align: center" colspan="6"><b>{{ 'NENHUM REGISTRO ENCONTRADO!'|trans }}</b></td> | ||
54 | + </tr> | ||
55 | + {% endfor %} | ||
56 | + </tbody> | ||
57 | + </table> | ||
58 | + <br /> | ||
59 | + <table class="table table-striped table-bordered"> | ||
60 | + <h4><center>{{ "Agentes para GNU/LINUX"|trans }}</h4> | ||
61 | + <thead> | ||
62 | + <tr> | ||
63 | + <th width="40%"style="text-align: center">{{ 'Arquivo'|trans }}</th> | ||
64 | + <th width="20%"style="text-align: center">{{ 'Versão'|trans }}</th> | ||
65 | + <th width="40%"style="text-align: center">{{ 'Hash'|trans }}</th> | ||
66 | + <th style="text-align: center"> | ||
67 | + <label style="margin: auto; width:12px; height:10px;"> | ||
68 | + <input type="checkbox" class="toggleCheck" name="toggleCheck[]" value="linux" checked> | ||
69 | + </label> | ||
70 | + </th> | ||
71 | + </tr> | ||
72 | + </thead> | ||
73 | + <tbody> | ||
74 | + {% for key, modulo in linux %} | ||
75 | + | ||
76 | + <tr id="item_{{ key }}"> | ||
77 | + <td style="text-align: center" id="item_desc_{{ key }}">{{ key }}</td> | ||
78 | + <td style="text-align: center" >{{ modulo['versao'] }}</td> | ||
79 | + <td style="text-align: center" >{{ modulo['hash'] }}</td> | ||
80 | + <td> | ||
81 | + <label style="margin: auto; width:12px; height:10px;"> | ||
82 | + <input type="checkbox" id="item_id_{{ key }}" name="linux" value="{{ key }}" checked> | ||
83 | + </label> | ||
84 | + </td> | ||
85 | + </tr> | ||
86 | + {% else %} | ||
87 | + <tr> | ||
88 | + <td style="text-align: center" colspan="6"><b>{{ 'NENHUM REGISTRO ENCONTRADO!'|trans }}</b></td> | ||
89 | + </tr> | ||
90 | + {% endfor %} | ||
91 | + | ||
92 | + </tbody> | ||
93 | + </table> | ||
94 | + <br /> | ||
95 | + | ||
96 | + <hr> | ||
97 | + <h3>{{ 'Subredes cadastradas'|trans }}</h3> | ||
98 | + <p>{{ 'Subredes onde a operação de atualização deve ser executada '|trans }}.</p> | ||
99 | + <br /> | ||
100 | + | ||
101 | + <h4 align="center">{{ "Legenda"|trans }}</h4> | ||
102 | + <table class="table table-bordered"> | ||
103 | + <thead> | ||
104 | + <tr> | ||
105 | + <th width="30%" style="text-align: center;">{{ "Mensagem"|trans }}</th> | ||
106 | + <th width="70%" style="text-align: center;">{{ "Significado"|trans }}</th> | ||
107 | + </tr> | ||
108 | + </thead> | ||
109 | + <tbody> | ||
110 | + <tr> | ||
111 | + <td width="30%" style="text-align: center;"><span class='label label-important'>{{ "Módulos inexistentes"|trans }}</span></td> | ||
112 | + <td width="70%">{{ "Um ou mais dos módulos obrigatórios não está presente na subrede"|trans }}</td> | ||
113 | + </tr> | ||
114 | + <tr> | ||
115 | + <td width="30%" style="text-align: center;"><span class='label label-warning'>{{ "Módulos desatualizados"|trans }}</span></td> | ||
116 | + <td width="70%">{{ "Um ou mais dos módulos obrigatórios está desatualizado na subrede"|trans }}</td> | ||
117 | + </tr> | ||
118 | + <tr> | ||
119 | + <td width="30%" style="text-align: center;"><span class='label label-success'>{{ "Módulos atualizados"|trans }}</span></td> | ||
120 | + <td width="70%">{{ "Todos os módulos obrigatórios estão atualizados na subrede"|trans }}</td> | ||
121 | + </tr> | ||
122 | + </tbody> | ||
123 | + </table> | ||
124 | + | ||
125 | + <h4 align="center">{{ subredes|length }} {{ "SubRedes Cadastradas"|trans }}</h4> | ||
126 | + <table class="table table-striped table-bordered"> | ||
127 | + | ||
128 | + <thead> | ||
129 | + <tr> | ||
130 | + <th width="15%" style="text-align: center">{{ 'Endereço IP'|trans }}</th> | ||
131 | + <th width="25%" style="text-align: center">{{ 'Nome da Subrede'|trans }}</th> | ||
132 | + <th width="20%" style="text-align: center">{{ 'Servidor de atualizacoes'|trans }}</th> | ||
133 | + <th width="20%" style="text-align: center">{{ 'Localizacao'|trans }}</th> | ||
134 | + <th width="20%" style="text-align: center">{{ 'Status'|trans }}</th> | ||
135 | + <th style="text-align: center"> | ||
136 | + <label style="margin: auto; width:12px; height:10px;"> | ||
137 | + <input type="checkbox" class="toggleCheck" name="toggleCheck[]" value="subrede"> | ||
138 | + </label> | ||
139 | + </th> | ||
140 | + </tr> | ||
141 | + </thead> | ||
142 | + | ||
143 | + <tbody> | ||
144 | + {% for key, rede in subredes %} | ||
145 | + <tr id="item_{{ key }}"> | ||
146 | + <td style="text-align: center" id="item_desc_{{ key }}">{{ rede['teIpRede'] }}</td> | ||
147 | + <td style="text-align: center" >{{ rede['nmRede'] }}</td> | ||
148 | + <td style="text-align: center" >{{ rede['teServUpdates'] }}</td> | ||
149 | + <td style="text-align: center" >{{ rede['nmLocal'] }}</td> | ||
150 | + <td style="text-align: center;">{{ rede['codigo']|raw }}</td> | ||
151 | + <td> | ||
152 | + <label style="margin: auto; width:12px; height:10px;"> | ||
153 | + <input type="checkbox" id="item_id_{{ key }}" name="subrede[]" value="{{ key }}"> | ||
154 | + </label> | ||
155 | + </td> | ||
156 | + </tr> | ||
157 | + {% else %} | ||
158 | + <tr> | ||
159 | + <td style="text-align: center" colspan="6"><b>{{ 'NENHUM REGISTRO ENCONTRADO!'|trans }}</b></td> | ||
160 | + </tr> | ||
161 | + {% endfor %} | ||
162 | + | ||
163 | + </tbody> | ||
164 | + </table> | ||
165 | + <div class="control-group" align="right"> | ||
166 | + <div class="controls"> | ||
167 | + <button type="reset" class="btn"> | ||
168 | + <i class="icon-refresh"></i> | ||
169 | + {{ "Resetar Valores"|trans }} | ||
170 | + </button> | ||
171 | + <button type="submit" formnovalidate class="btn btn-primary"> | ||
172 | + <i class="icon-ok-sign"></i> | ||
173 | + {{ "Executar Atualizações"|trans }} | ||
174 | + </button> | ||
175 | + </div> | ||
176 | + </div> | ||
177 | + | ||
178 | + </form> | ||
179 | + | ||
180 | + </div> <!-- /block --> | ||
181 | + </div><!-- /box --> | ||
182 | + | ||
183 | + </div><!-- /span --> | ||
184 | +</div><!-- /row --> | ||
185 | +{% endblock %} | ||
186 | + | ||
187 | +{% block javascripts %} | ||
188 | + | ||
189 | +{{ parent() }} | ||
190 | + | ||
191 | +<script type="text/javascript"> | ||
192 | + System.Form.toggleCheck(); // Ativa o monitoramento de Clique no checkbox para marcar/desmarcar todos | ||
193 | +</script> | ||
194 | + | ||
195 | +{% endblock %} | ||
0 | \ No newline at end of file | 196 | \ No newline at end of file |