<?php ob_start(); @session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/templateCliente.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>E-TIcons, Empresa de tecnologia</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link rel="stylesheet" href="jquery/skin.css" media="screen" />
<link rel="stylesheet" href="css/cssCliente.css" media="screen"/>
<script type="text/javascript" src="jquery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.9.1.custom.min.js"></script>
<script type="text/javascript" src="jquery/jquery-themeswitchertool.js"></script>
<script type="text/javascript" src="jquery/jquery-clientes.js"></script>
</head>
<body>
<?php
$usuarioLogado = $_SESSION['usuarioCliente'];
if($usuarioLogado == NULL || $usuarioLogado == ""){ 
	header('location: login.php');
} else {
	$nivel = $_SESSION['nivel'];
	$display = ($nivel == '2' ? '' : 'none');
?>
<div class="tudo">
  <div class="topoAdmin">
    <div class="topo_int"> <img src="imagens/bg_topo_esq_preto.png" align="left"/>
      <div class="opcoes_topo">
        <form action="./Servico.php" method="post" name="formSair">
          <input type="hidden" name="metodo" value="GerenciadorUsuario.sair" />
          <ul id="menuTopo">
            <li class="usuario" id="usuario"><?php echo @utf8_encode($usuarioLogado); ?></li>
            <li><span class="ui-icon ui-icon-close"></span><a onclick="javascript:formSair.submit();">Sair</a></li>
            <li><span class="ui-icon ui-icon-home"></span><a href="inicio.php" title="Inicio">Home</a></li>
            <li><span class="ui-icon ui-icon-help"></span><a href="ajuda.php" title="Ajuda/Help-Desk">Ajuda</a></li>
            <li><span class="ui-icon ui-icon-contact"></span><a href="contato.php" title="Contato">Contato</a></li>
          </ul>
        </form>
      </div>
      <!-- opcoes_topo -->
      <div class="logomarca"><img src="imagens/areacliente.png"/></div>
      <img src="imagens/bg_topo_dir_preto.png" align="right"/> </div>
    <!-- topo_int --> 
  </div>
  <!-- topo -->
  <div class="menu_sup">
    <div class="titulo_pagina"><!-- InstanceBeginEditable name="titulo" -->
      <div class="ui-widget ui-corner-top"><span class="ui-icon ui-icon-newwin"></span><span class="titulo">Edição de Sistemas</span></div>
      <!-- InstanceEndEditable --></div>
    <ul id="menu_sup" class="ui-menu-horizontal">
      <li><a href="downloads.php"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span>Downloads</a></li>
      <li><a><span class="ui-icon ui-icon-comment"></span>Sugestões</a>
        <ul>
          <li style="display:<?php echo $display; ?>"><a href="sugestoes.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li>
          <li><a href="cadastroSugestao.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li>
        </ul>
      </li>
      <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-person"></span>Usuários</a>
        <ul>
          <li><a href="usuarios.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li>
          <li><a href="usuario.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li>
          <li><a href="solicitantes.php"><span class="ui-icon ui-icon-contact"></span>Solicitações</a></li>
          <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-contact"></span>Interessados</a>
            <ul>
              <li><a href="interessados.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li>
            </ul>
          </li>
        </ul>
      </li>
      <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-newwin"></span>Sistemas</a>
        <ul>
          <li><a href="sistemas.php"><span class="ui-icon ui-icon-gear"></span>Gerenciar</a></li>
          <li><a href="cadastroSistema.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li>
          <li><a href="downloads.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li>
        </ul>
      </li>
      <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-signal-diag"></span>Notícias</a>
        <ul>
          <li><a href="noticias.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li>
          <li><a href="cadastroNoticia.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li>
        </ul>
      </li>
      <li><a><span class="ui-icon ui-icon-wrench"></span>Ferramentas</a>
        <ul>
          <li style="display:<?php echo $display; ?>"><a href="clientes.php"><span class="ui-icon ui-icon-suitcase"></span>Gerenciar Clientes</a></li>
          <li style="display:<?php echo $display; ?>;"><a href="email.php"><span class="ui-icon ui-icon-mail-closed"></span>Enviar E-mail</a></li>
          <li><a href="ajuda.php"><span class="ui-icon ui-icon-help"></span>Ajuda</a></li>
          <li><a href="configuracoes.php"><span class="ui-icon ui-icon-gear"></span>Configurações</a></li>
          <li><a href="inicio.php"><span class="ui-icon ui-icon-home"></span>Início</a></li>
          <li><a onclick="javascript:formSair.submit();"><span class="ui-icon ui-icon-close"></span>Sair</a></li>
        </ul>
      </li>
    </ul>
  </div>
  <!-- menu_sup -->
  <div class="conteudo"> <!-- InstanceBeginEditable name="conteudo" -->
    <?php if($nivel != "2"){ header("location: inicio.php"); } ?>
    <script type="text/javascript" src="jquery/editor/jquery.wysiwyg.js"></script>
    <link rel="stylesheet" type="text/css" href="jquery/editor/jquery.wysiwyg.css" />
    <script type="text/javascript">
	$(function() {
		var sistema = $('#id').val();
		$("#dialog-confirm").dialog({autoOpen: false, resizable: false, height:200,modal: true,buttons: {
		"OK": function() { window.location='Servico.php?metodo=GerenciadorSistemas.deletar&sistema='+sistema; $(this).dialog("close"); },
			Cancelar: function(){$( this ).dialog("close");}}});
		$('#deletar').click(function(){$("#dialog-confirm").dialog("open"); });
		$('#novo').click(function(){ window.location='cadastroSistema.php'; });
	});
   </script>
    <div class="formulario">
      <div class="ui-widget ui-widget-content ui-corner-top menus">
        <?php
				include 'beans/GerenciadorSistemas.class.php';
				$sistemasMB = new GerenciadorSistemas();
				$sistemas = $sistemasMB->listaSistemas();
				$sistema = !empty($_GET['sistema']) ? $_GET['sistema'] : "";
				$sistema = ($sistema == "" ? 1 : $sistema);
				foreach($sistemas as $s){
					if($s->getId() == $sistema){ $sistema = $s; }
				}
            ?>
        <form name="formSistemas" action="sistemas.php" method="get">
          <label>Selecione um Sistema : </label>
          <select id="sistema" name="sistema" class="ui-widget ui-widget-content ui-corner-left campoSelect" style="width:200px;">
            <?php
				echo "<option selected value=\"".$sistema->getId()."\">".utf8_encode($sistema->getNome())."</option>";
            	foreach($sistemas as $i){ 
					if($i->getId() != $sistema->getId()){ echo "<option value=\"".$i->getId()."\" >".utf8_encode($i->getNome())."</option>"; }
				}
            ?>
          </select>
          <button type="submit" class="button"><span class="ui-icon ui-icon-search"></span>Exibir</button>
        </form>
      </div>
      <div class="ui-widget ui-state-active ui-corner-bottom menus" align="center">
        <?php  echo  '<strong>'.utf8_encode($sistema->getNome()).'</strong>'; ?>
      </div>
      <?php $service = ServiceMessages::getInstancia(); $service->printMessage(); ?>
      <form action="Servico.php" method="post" id="formSistema" enctype="multipart/form-data" onsubmit="return salvarSistema();">
        <div class="forms">
          <p>
            <input type="hidden" name="metodo" value="GerenciadorSistemas.alterarSistema"/>
            <input type="hidden" name="id" id="id" value="<?php echo $sistema->getId(); ?>" />
          <div class="esq">
            <label class="label">Arquivo (por upload):</label>
            <input name="upload" id="arquivoFile" type="file" class="ui-widget ui-widget-content ui-corner-all campo" size="35"/>
            <label class="label">Arquivo (por nome):</label>
            <input type="text" id="arquivo" name="arquivo" class="ui-widget ui-widget-content ui-corner-all campo" size="55" value="<?php echo $sistema->getArquivo(); ?>" />
            <label class="label">Instalação:</label>
            <input type="text" id="instalacao" name="instalacao" class="ui-widget ui-widget-content ui-corner-all campo" size="55" value="<?php echo utf8_encode($sistema->getInstalacao()); ?>" />
            <label class="label">Nome:</label>
            <input type="text" id="nome" name="nome" class="ui-widget ui-widget-content ui-corner-all campo" size="45" value="<?php echo utf8_encode($sistema->getNome()); ?>" />
            <label class="label">Descrição:</label>
            <input type="text" id="descricao" name="descricao" class="ui-widget ui-widget-content ui-corner-all campo" size="75" value="<?php echo utf8_encode($sistema->getDescricao()); ?>" />
            <label class="label">Versão:</label>
            <input type="text" id="versao" name="versao" class="ui-widget ui-widget-content ui-corner-all campo" size="15" value="<?php echo $sistema->getVersao(); ?>" />
            <label class="label">Comentário:</label>
            <textarea id="comentario" name="comentario" onkeypress="return adic(event)" class="ui-widget ui-widget-content ui-corner-all" rows="5" cols="80"></textarea>
            <label class="label">Data:</label>
            <input type="text" id="data" name="data" readonly="readonly" class="ui-widget ui-widget-content ui-corner-all campo" size="30" value="<?php echo $sistema->getData(); ?>" />
            <label class="label">Texto:</label>
            <textarea name="texto" id="texto" rows="10" style="width:630px;"><?php echo utf8_encode($sistema->getTexto()); ?></textarea>
            <br />
          </div>
          <fieldset class="dir">
            <legend>Caixa</legend>
            <div align="center"><img src="/resources/imagens/sistemas/<?php echo $sistema->getImagem(); ?>" /></div>
            <label class="label">Selecione uma nova imagem:</label>
            <input name="imagem" id="imagem" type="file" class="ui-widget ui-widget-content ui-corner-all campo" size="25"/>
          </fieldset>
          <p class="ui-widget ui-widget-content ui-corner-all texto-conteudo menu_extra" align="center">
            <button type="button" id="deletar" class="button ui-buttonset"><span class="ui-icon ui-icon-trash"></span>Deletar</button>
            <button type="submit" id="alterar" class="button ui-buttonset"><span class="ui-icon ui-icon-disk"></span>Salvar Alterações</button>
          </p>
          </p>
        </div>
      </form>
    </div>
    <div id="dialog-confirm" title="Excluir sistema">
      <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span> Tem certeza que deseja excluir este sistema?</p>
    </div>
    <script type="text/javascript">
(function($){
  $('#texto').wysiwyg({
    controls: {
	  insertImage   : { visible : false },
      strikeThrough : { visible : true },
      underline     : { visible : true },
      separator00   : { visible : true },
      justifyLeft   : { visible : true },
      justifyCenter : { visible : true },
      justifyRight  : { visible : true },
      justifyFull   : { visible : true },
      separator01 : { visible : true },
      indent  : { visible : true },
      outdent : { visible : true },
      separator02 : { visible : true },
      subscript   : { visible : true },
      superscript : { visible : true },
      separator03 : { visible : true },
      undo : { visible : true },
      redo : { visible : true },
      separator04 : { visible : true },
      insertOrderedList    : { visible : true },
      insertUnorderedList  : { visible : true },
      insertHorizontalRule : { visible : true },
      h4mozilla : { visible : true && $.browser.mozilla, className : 'h4', command : 'heading', arguments : ['h4'], tags : ['h4'], tooltip : "Header 4" },
      h5mozilla : { visible : true && $.browser.mozilla, className : 'h5', command : 'heading', arguments : ['h5'], tags : ['h5'], tooltip : "Header 5" },
      h6mozilla : { visible : true && $.browser.mozilla, className : 'h6', command : 'heading', arguments : ['h6'], tags : ['h6'], tooltip : "Header 6" },
      
      h4 : { visible : true && !( $.browser.mozilla ), className : 'h4', command : 'formatBlock', arguments : ['<H4>'], tags : ['h4'], tooltip : "Header 4" },
      h5 : { visible : true && !( $.browser.mozilla ), className : 'h5', command : 'formatBlock', arguments : ['<H5>'], tags : ['h5'], tooltip : "Header 5" },
      h6 : { visible : true && !( $.browser.mozilla ), className : 'h6', command : 'formatBlock', arguments : ['<H6>'], tags : ['h6'], tooltip : "Header 6" },
      separator07 : { visible : true },
      cut   : { visible : true },
      copy  : { visible : true },
      paste : { visible : true }
    }
  });
})(jQuery);
</script> 
    <!-- InstanceEndEditable --> </div>
  <!-- conteudo -->
  <div class="rodape" id="rodape">&copy; 2008 E-Ticons, Todos os direitos reservados
    <div align="center">- www.e-ticons.com.br, fone/fax: (83) 3241-9973 -</div>
  </div>
  <span id="log" class="ajaxStatus"><img src="imagens/ajaxload.gif"/></span></div>
<!-- tudo --> 
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-27091929-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
<?php } ?>
</body>
<!-- InstanceEnd -->
</html>
