Commit fac46c50719a846865f841a82dfb9c23188e6dcb

Authored by Lucas D'Avila
1 parent 3d748b50
Exists in master

Removido arquivos desnecessários

ieducar/intranet/erro_banco.php
... ... @@ -1,88 +0,0 @@
1   -<?php
2   -
3   -/*
4   - * i-Educar - Sistema de gestão escolar
5   - *
6   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
7   - * <ctima@itajai.sc.gov.br>
8   - *
9   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
10   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
11   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
12   - * qualquer versão posterior.
13   - *
14   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
15   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
16   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
17   - * do GNU para mais detalhes.
18   - *
19   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - */
23   -
24   -/**
25   - * Mostra mensagem de erro de conexão com o banco de dados.
26   - *
27   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
28   - * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
29   - * @package Core
30   - * @since Arquivo disponível desde a versão 1.0.1
31   - * @version $Id$
32   - */
33   -?>
34   -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
35   -<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br">
36   - <head>
37   - <title></title>
38   - <style type="text/css">
39   - * {
40   - margin: 0;
41   - padding: 0
42   - }
43   -
44   - body {
45   - align: center;
46   - font-size: 85%;
47   - font-family: verdana, arial, sans-serif;
48   - line-height: 160%
49   - }
50   -
51   - div#error {
52   - width: 500px;
53   - position: absolute;
54   - left: 250px;
55   - top: 35px;
56   - border: 1px solid #666
57   - }
58   -
59   - div.content {
60   - padding: 25px
61   - }
62   -
63   - h1 {
64   - padding-bottom: 15px
65   - }
66   -
67   - ul {
68   - margin-top: 20px;
69   - list-style-position: inside
70   - }
71   - </style>
72   -
73   - </head>
74   -
75   - <body>
76   - <div id="error">
77   - <div class="content">
78   - <h1>Erro</h1>
79   - <p>Ocorreu um erro de conexão com o banco de dados.</p>
80   - <ul>Sugestões:
81   - <li>Verifique se o seu banco de dados está corretamente configurado e se o serviço relacionado está executando</li>
82   - <li>Verifique se configurou o i-Educar com os parâmetros corretos de conexão com o banco de dados no arquivo <code>configuration/ieducar.ini</code></li>
83   - <li><a href="http://svn.softwarepublico.gov.br/trac/ieducar#FAQsetutoriais">Consulte a documentação do i-Educar</a> sobre os procedimentos de instalação da versão desejada</li>
84   - </ul>
85   - </div>
86   - </div>
87   - </body>
88   -</html>
89 0 \ No newline at end of file
ieducar/intranet/imagens/brasao.gif

13.3 KB

ieducar/intranet/imagens/brasao.jpg

8.74 KB

ieducar/intranet/imagens/brasao_azul.gif

12.7 KB

ieducar/intranet/imagens/brasao_azul.jpg

45.3 KB

ieducar/intranet/imagens/brasao_secom.jpg

5.13 KB

ieducar/intranet/imagens/brasao_secon.jpg

6.99 KB

ieducar/intranet/imagens/brasaon.gif

13.3 KB

ieducar/intranet/imagens/cvi.jpg

6.54 KB

ieducar/intranet/imagens/i-educar/splashscreen.jpg

21 KB

ieducar/intranet/imagens/i-educar/splashscreen_bibl.jpg

22.6 KB

ieducar/intranet/include/menu/clsMenu.inc.php
... ... @@ -1,68 +0,0 @@
1   -<?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   -* *
4   -* @author Prefeitura Municipal de Itajaí *
5   -* @updated 29/03/2007 *
6   -* Pacote: i-PLB Software Público Livre e Brasileiro *
7   -* *
8   -* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   -* ctima@itajai.sc.gov.br *
10   -* *
11   -* Este programa é software livre, você pode redistribuí-lo e/ou *
12   -* modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   -* publicada pela Free Software Foundation, tanto a versão 2 da *
14   -* Licença como (a seu critério) qualquer versão mais nova. *
15   -* *
16   -* Este programa é distribuído na expectativa de ser útil, mas SEM *
17   -* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   -* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   -* sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   -* *
21   -* Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   -* junto com este programa. Se não, escreva para a Free Software *
23   -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   -* 02111-1307, USA. *
25   -* *
26   -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -?>
28   -
29   -<html>
30   -<head>
31   -
32   - <link rel=stylesheet type='text/css' href='http://nat-bp-spo.cobra.com.br/styles/menu.css' >
33   - <script type='text/javascript' src='http://nat-bp-spo.cobra.com.br/scripts/dom.js'></script>
34   - <script type='text/javascript' src='http://nat-bp-spo.cobra.com.br/scripts/menu.js'></script>
35   -</head>
36   -<body>
37   -<script>
38   -/************************************************************
39   -Coolmenus Beta 4.04 - Copyright Thomas Brattli - www.dhtmlcentral.com
40   -Last updated: 03.22.02
41   -*************************************************************/
42   -/*Browsercheck object*/
43   -
44   -menu[0] = new Array("Estoque",1,'','', '');
45   -menu[1] = new Array("Higor",2,1,'','');
46   -menu[2] = new Array("Cadastro",4,'','','');
47   -
48   -
49   -</script>
50   -<table>
51   -<tr>
52   -<td id="as">
53   -assas
54   -</td>
55   -
56   -<td id="pega">
57   -
58   -<script>
59   - var posx = DOM_ObjectPosition_getPageOffsetLeft(document.getElementById('pega'));
60   - var posy = DOM_ObjectPosition_getPageOffsetTop(document.getElementById('pega'));
61   - MontaMenu(menu, posx,posy);
62   -</script>
63   -<td>
64   -</tr>
65   -</body>
66   -
67   -</html>
68   -
ieducar/intranet/include/pmieducar/educar_campo_lista_backup.php
... ... @@ -1,1332 +0,0 @@
1   -<?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   -* *
4   -* @author Prefeitura Municipal de Itajaí *
5   -* @updated 29/03/2007 *
6   -* Pacote: i-PLB Software Público Livre e Brasileiro *
7   -* *
8   -* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   -* ctima@itajai.sc.gov.br *
10   -* *
11   -* Este programa é software livre, você pode redistribuí-lo e/ou *
12   -* modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   -* publicada pela Free Software Foundation, tanto a versão 2 da *
14   -* Licença como (a seu critério) qualquer versão mais nova. *
15   -* *
16   -* Este programa é distribuído na expectativa de ser útil, mas SEM *
17   -* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   -* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   -* sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   -* *
21   -* Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   -* junto com este programa. Se não, escreva para a Free Software *
23   -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   -* 02111-1307, USA. *
25   -* *
26   -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   - if(!isset($exibe_campo_lista_curso_escola))
28   - {
29   - $exibe_campo_lista_curso_escola = true;
30   - }
31   -
32   - if ($obrigatorio)
33   - {
34   - $instituicao_obrigatorio = $escola_obrigatorio = $curso_obrigatorio = $escola_curso_obrigatorio = $escola_curso_serie_obrigatorio = $serie_obrigatorio = $biblioteca_obrigatorio = $cliente_tipo_obrigatorio = $funcao_obrigatorio = $turma_obrigatorio = true;
35   - }
36   - else
37   - {
38   - $instituicao_obrigatorio = isset($instituicao_obrigatorio) ? $instituicao_obrigatorio : false;
39   - $escola_obrigatorio = isset($escola_obrigatorio) ? $escola_obrigatorio : false;
40   - $curso_obrigatorio = isset($curso_obrigatorio) ? $curso_obrigatorio : false;
41   - $escola_curso_obrigatorio = isset($escola_curso_obrigatorio) ? $escola_curso_obrigatorio : false;
42   - $escola_curso_serie_obrigatorio = isset($escola_curso_serie_obrigatorio) ? $escola_curso_serie_obrigatorio : false;
43   - $serie_obrigatorio = isset($serie_obrigatorio) ? $serie_obrigatorio : false;
44   - $biblioteca_obrigatorio = isset($biblioteca_obrigatorio) ? $biblioteca_obrigatorio : false;
45   - $cliente_tipo_obrigatorio = isset( $cliente_tipo_obrigatorio ) ? $cliente_tipo_obrigatorio : false;
46   - $funcao_obrigatorio = isset( $funcao_obrigatorio ) ? $funcao_obrigatorio : false;
47   - $turma_obrigatorio = isset( $turma_obrigatorio ) ? $turma_obrigatorio : false;
48   - }
49   -
50   - if ($desabilitado)
51   - {
52   - $instituicao_desabilitado = $escola_desabilitado = $curso_desabilitado = $escola_curso_desabilitado = $escola_curso_serie_desabilitado = $serie_desabilitado = $biblioteca_desabilitado = $cliente_tipo_desabilitado = $turma_desabilitado = true;
53   - }
54   - else
55   - {
56   - $instituicao_desabilitado = isset($instituicao_desabilitado) ? $instituicao_desabilitado : false;
57   - $escola_desabilitado = isset($escola_desabilitado) ? $escola_desabilitado : false;
58   - $curso_desabilitado = isset($curso_desabilitado) ? $curso_desabilitado : false;
59   - $escola_curso_desabilitado = isset($escola_curso_desabilitado) ? $escola_curso_desabilitado : false;
60   - $escola_curso_serie_desabilitado = isset($escola_curso_serie_desabilitado) ? $escola_curso_serie_desabilitado : false;
61   - $serie_desabilitado = isset($serie_desabilitado) ? $serie_desabilitado : false;
62   - $biblioteca_desabilitado = isset($biblioteca_desabilitado) ? $biblioteca_desabilitado : false;
63   - $cliente_tipo_desabilitado = isset( $cliente_tipo_desabilitado ) ? $cliente_tipo_desabilitado : false;
64   - $funcao_desabilitado = isset( $funcao_desabilitado ) ? $funcao_desabilitado : false;
65   - $turma_desabilitado = isset( $turma_desabilitado ) ? $turma_desabilitado : false;
66   - }
67   -
68   - $obj_permissoes = new clsPermissoes();
69   - $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
70   -
71   - if( $nivel_usuario == 1 || $cad_usuario )
72   - {
73   - $opcoes = array( "" => "Selecione" );
74   - $obj_instituicao = new clsPmieducarInstituicao();
75   - $obj_instituicao->setCamposLista("cod_instituicao, nm_instituicao");
76   - $obj_instituicao->setOrderby("nm_instituicao ASC");
77   - $lista = $obj_instituicao->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,1);
78   - if ( is_array( $lista ) && count( $lista ) )
79   - {
80   - foreach ( $lista as $registro )
81   - {
82   - $opcoes["{$registro['cod_instituicao']}"] = "{$registro['nm_instituicao']}";
83   - }
84   - }
85   -
86   - if ($get_escola && $get_biblioteca)
87   - {
88   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getDuplo();",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
89   - }
90   - else if ($get_escola && $get_curso )
91   - {
92   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao, "getDuploEscolaCurso();", null, null, null, $instituicao_desabilitado, $instituicao_obrigatorio );
93   - }
94   - else if ($get_escola)
95   - {
96   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getEscola();",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
97   - }
98   - else if ($get_curso)
99   - {
100   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getCurso();",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
101   - }
102   - else if ($get_biblioteca)
103   - {
104   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getBiblioteca(1);",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
105   - }
106   - else if ( $get_cliente_tipo )
107   - {
108   - $this->campoLista( "ref_cod_cliente_tipo", "Tipo de Cliente", $opcoes, $this->ref_cod_cliente_tipo, "getCliente();", null, null, null, $cliente_tipo_desabilitado, $cliente_tipo_obrigatorio );
109   - }
110   - else
111   - {
112   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
113   - }
114   - }
115   - elseif ( $nivel_usuario != 1 )
116   - {
117   - $obj_usuario = new clsPmieducarUsuario($this->pessoa_logada);
118   - $det_usuario = $obj_usuario->detalhe();
119   - $this->ref_cod_instituicao = $det_usuario["ref_cod_instituicao"];
120   - $this->campoOculto( "ref_cod_instituicao", $this->ref_cod_instituicao );
121   - if ($nivel_usuario == 4 || $nivel_usuario == 8)
122   - {
123   - $obj_usuario = new clsPmieducarUsuario($this->pessoa_logada);
124   - $det_usuario = $obj_usuario->detalhe();
125   - $this->ref_cod_escola = $det_usuario["ref_cod_escola"];
126   - $this->campoOculto( "ref_cod_escola", $this->ref_cod_escola );
127   - if($exibe_nm_escola == true)
128   - {
129   - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
130   - $det_escola = $obj_escola->detalhe();
131   - $nm_escola = $det_escola['nome'];
132   - $this->campoRotulo( "nm_escola","Escola", $nm_escola );
133   - }
134   - if ( $get_biblioteca )
135   - {
136   - $obj_per = new clsPermissoes();
137   - $ref_cod_biblioteca_ = $obj_per->getBiblioteca( $this->pessoa_logada );
138   -
139   - }
140   - }
141   - }
142   -
143   - if ( $get_escola && ( $nivel_usuario == 1 || $nivel_usuario == 2 || $cad_usuario ) )
144   - {
145   - $opcoes_escola = array( "" => "Selecione uma escola" );
146   - $todas_escolas = "escola = new Array();\n";
147   - $obj_escola = new clsPmieducarEscola();
148   - $obj_escola->setOrderby("nome ASC");
149   - $lista = $obj_escola->lista(null,null,null,null,null,null,null,null,null,null,1);
150   - if ( is_array( $lista ) && count( $lista ) )
151   - {
152   - foreach ( $lista as $registro )
153   - {
154   - $todas_escolas .= "escola[escola.length] = new Array( {$registro["cod_escola"]}, '{$registro['nome']}', {$registro["ref_cod_instituicao"]} );\n";
155   - }
156   - }
157   - echo "<script>{$todas_escolas}</script>";
158   -
159   - // EDITAR
160   - if ($this->ref_cod_instituicao)
161   - {
162   - $obj_escola = new clsPmieducarEscola();
163   - $obj_escola->setOrderby("nome ASC");
164   - $lista = $obj_escola->lista(null,null,null,$this->ref_cod_instituicao,null,null,null,null,null,null,1);
165   - if ( is_array( $lista ) && count( $lista ) )
166   - {
167   - foreach ( $lista as $registro )
168   - {
169   - $opcoes_escola["{$registro["cod_escola"]}"] = "{$registro['nome']}";
170   - }
171   - }
172   - }
173   -
174   - if ($get_biblioteca)
175   - {
176   - $this->campoLista( "ref_cod_escola", "Escola", $opcoes_escola, $this->ref_cod_escola,"getBiblioteca(2);",null,null,null,$escola_desabilitado,$escola_obrigatorio );
177   - }
178   - else
179   - {
180   - $this->campoLista( "ref_cod_escola", "Escola", $opcoes_escola, $this->ref_cod_escola,null,null,null,null,$escola_desabilitado,$escola_obrigatorio );
181   - }
182   - }
183   -
184   - if ($get_curso)
185   - {
186   - $opcoes_curso = array( "" => "Selecione" );
187   - $todos_cursos = "curso = new Array();\n";
188   - $obj_curso = new clsPmieducarCurso();
189   - $obj_curso->setOrderby("nm_curso ASC");
190   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1);
191   - if ( is_array( $lista ) && count( $lista ) )
192   - {
193   - foreach ( $lista as $registro )
194   - {
195   - $todos_cursos .= "curso[curso.length] = new Array( {$registro["cod_curso"]}, '{$registro['nm_curso']}', {$registro['qtd_etapas']}, {$registro["ref_cod_instituicao"]}, {$registro["padrao_ano_escolar"]} );\n";
196   - }
197   - }
198   - echo "<script>{$todos_cursos}</script>";
199   -
200   - // EDITAR
201   - if ($this->ref_cod_instituicao && (!$this->ref_cod_escola && !isset($sem_padrao)))
202   - {
203   - $opcoes_curso = array( "" => "Selecione" );
204   - $obj_curso = new clsPmieducarCurso();
205   - $obj_curso->setOrderby("nm_curso ASC");
206   -
207   - if ($sem_padrao)
208   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,$this->ref_cod_instituicao,0 );
209   - else
210   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,$this->ref_cod_instituicao);
211   -
212   - if ( is_array( $lista ) && count( $lista ) )
213   - {
214   - foreach ( $lista as $registro )
215   - {
216   - $opcoes_curso["{$registro['cod_curso']}"] = "{$registro['nm_curso']}";
217   - }
218   - }
219   -
220   - }
221   - $this->campoLista( "ref_cod_curso", "Curso", $opcoes_curso, $this->ref_cod_curso,null,null,null,null,true,$curso_obrigatorio );
222   - }
223   -
224   - if ( $get_escola_curso )
225   - {
226   - $opcoes_cursos_escola = array( "" => "Selecione" );
227   - $todos_cursos_escola = "escola_curso = new Array();\n";
228   - $obj_escola_curso = new clsPmieducarEscolaCurso();
229   -// $obj_escola_curso->setOrderby("ref_cod_curso ASC");
230   - $lst_escola_curso = $obj_escola_curso->lista( null,null,null,null,null,null,null,null,1 );
231   - if ( is_array( $lst_escola_curso ) && count( $lst_escola_curso ) )
232   - {
233   - foreach ( $lst_escola_curso as $escola_curso )
234   - {
235   - //$obj_curso = new clsPmieducarCurso( $escola_curso["ref_cod_curso"] );
236   - //$det_curso = $obj_curso->he();
237   - if(isset($curso_padrao_ano_escolar) && $det_curso['padrao_ano_escolar'] != $curso_padrao_ano_escolar)
238   - continue;
239   - $todos_cursos_escola .= "escola_curso[escola_curso.length] = new Array( {$escola_curso["ref_cod_curso"]}, '{$escola_curso['nm_curso']}', {$escola_curso["ref_cod_escola"]}, {$escola_curso["padrao_ano_escolar"]} );\n";
240   - }
241   - }
242   - echo "<script>{$todos_cursos_escola}</script>";
243   -
244   - // EDITAR
245   - if ( $this->ref_cod_escola )
246   - {
247   - $obj_escola_curso = new clsPmieducarEscolaCurso();
248   -// $obj_escola_curso->setOrderby("ref_cod_curso ASC");
249   -
250   - $lst_escola_curso = $obj_escola_curso->lista( $this->ref_cod_escola,null,null,null,null,null,null,null,1 );
251   -
252   - if ( is_array( $lst_escola_curso ) && count( $lst_escola_curso ) )
253   - {
254   - foreach ( $lst_escola_curso as $escola_curso )
255   - {
256   - //$obj_curso = new clsPmieducarCurso( $escola_curso["ref_cod_curso"] );
257   - //$det_curso = $obj_curso->detalhe();
258   - $opcoes_cursos_escola["{$escola_curso["ref_cod_curso"]}"] = $escola_curso['nm_curso'];
259   - }
260   - }
261   - }
262   - if($exibe_campo_lista_curso_escola /*&& ! isset($sem_padrao)*/)
263   - $this->campoLista( "ref_cod_curso", "Curso", $opcoes_cursos_escola, $this->ref_cod_curso, null, null, null, null, $escola_curso_desabilitado, $escola_curso_obrigatorio );
264   - }
265   -
266   - if ( $get_escola_curso_serie )
267   - {
268   -
269   - $opcoes_series_curso_escola = array( "" => "Selecione" );
270   - if( class_exists( "clsPmieducarEscolaSerie" ) && class_exists( "clsPmieducarSerie" ) )
271   - {
272   - $todas_series_curso_escola = "serie = new Array();\n";
273   - $obj_escola_serie = new clsPmieducarEscolaSerie();
274   - $obj_escola_serie->setOrderby("nm_serie ASC");
275   - $lst_escola_serie = $obj_escola_serie->lista( null,null,null,null,null,null,null,null,null,null,null,null,1 );
276   - if ( is_array( $lst_escola_serie ) && count( $lst_escola_serie ) )
277   - {
278   - foreach ( $lst_escola_serie as $escola_curso_serie )
279   - {
280   -
281   - $escola_curso_serie["hora_inicial"] = date("H:i", strtotime( $escola_curso_serie["hora_inicial"]));
282   - $escola_curso_serie["hora_final"] = date("H:i", strtotime( $escola_curso_serie["hora_final"]));
283   - $escola_curso_serie["hora_inicio_intervalo"] = date("H:i", strtotime( $escola_curso_serie["hora_inicio_intervalo"]));
284   - $escola_curso_serie["hora_fim_intervalo"] = date("H:i", strtotime( $escola_curso_serie["hora_fim_intervalo"]));
285   - //$obj_serie = new clsPmieducarSerie( $escola_curso_serie["ref_cod_serie"] );
286   - //$det_serie = $obj_serie->detalhe();
287   - $todas_series_curso_escola .= "serie[serie.length] = new Array( {$escola_curso_serie["ref_cod_serie"]}, '{$escola_curso_serie['nm_serie']}', {$escola_curso_serie["ref_cod_escola"]}, {$escola_curso_serie["ref_cod_curso"]}, '{$escola_curso_serie["hora_inicial"]}', '{$escola_curso_serie["hora_final"]}', '{$escola_curso_serie["hora_inicio_intervalo"]}', '{$escola_curso_serie["hora_fim_intervalo"]}' );\n";
288   - }
289   - }
290   - echo "<script>{$todas_series_curso_escola}</script>";
291   -
292   - // EDITAR
293   - if ( $this->ref_cod_escola && $this->ref_cod_curso )
294   - {
295   - $obj_escola_serie = new clsPmieducarEscolaSerie();
296   - $obj_escola_serie->setOrderby("nm_serie ASC");
297   - $lst_escola_serie = $obj_escola_serie->lista( $this->ref_cod_escola,null,null,null,null,null,null,null,null,null,null,null,1,null,null,null,null,null,$this->ref_cod_curso );
298   - if ( is_array( $lst_escola_serie ) && count( $lst_escola_serie ) )
299   - {
300   - foreach ( $lst_escola_serie as $escola_curso_serie )
301   - {
302   - //$obj_serie = new clsPmieducarSerie( $escola_curso_serie["ref_cod_serie"] );
303   - //$det_serie = $obj_serie->detalhe();
304   - $opcoes_series_curso_escola["{$escola_curso_serie["ref_cod_serie"]}"] = $escola_curso_serie['nm_serie'];
305   - }
306   - }
307   - }
308   - }
309   - else
310   - {
311   - echo "<!--\nErro\nClasse(s) clsPmieducarEscolaSerie / clsPmieducarSerie n&atilde;o encontrada(s)\n-->";
312   - $opcoes_series_curso_escola = array( "" => "Erro na gera&ccedil;&atilde;o" );
313   - }
314   - $this->campoLista( "ref_ref_cod_serie", "S&eacute;rie", $opcoes_series_curso_escola, $this->ref_ref_cod_serie, null, null, null, null, $escola_curso_serie_desabilitado, $escola_curso_serie_obrigatorio );
315   -
316   - }
317   -
318   - if ( $get_serie )
319   - {
320   -
321   - $opcoes_serie = array( "" => "Selecione" );
322   - if( class_exists( "clsPmieducarSerie" ) )
323   - {
324   - $todas_series = "serie = new Array();\n";
325   - $obj_serie = new clsPmieducarSerie();
326   - $obj_serie->setOrderby("nm_serie ASC");
327   - $lst_serie = $obj_serie->lista( null,null,null,null,null,null,null,null,null,null,null,null,1 );
328   -
329   - if ( is_array( $lst_serie ) && count( $lst_serie ) )
330   - {
331   - foreach ( $lst_serie as $serie )
332   - {
333   - if ($get_escola_serie)
334   - {
335   - $obj_escola_serie = new clsPmieducarEscolaSerie();
336   - $obj_escola_serie->setOrderby("nm_serie ASC");
337   - $lst_escola_serie = $obj_escola_serie->lista( null,$serie["cod_serie"],null,null,null,null,null,null,null,null,null,null,1 );
338   - if ( is_array( $lst_escola_serie ) && count( $lst_escola_serie ) )
339   - {
340   - $arr = "new Array(";
341   - $conc = "";
342   - foreach ( $lst_escola_serie as $escola_serie )
343   - {
344   - $arr .= "{$conc}'{$escola_serie["ref_cod_escola"]}'";
345   - $conc = ",";
346   - }
347   - $arr .= ")";
348   - }else
349   - {
350   - $arr = "new Array()";
351   - }
352   - $todas_series .= "serie[serie.length] = new Array( {$serie["cod_serie"]}, '{$serie['nm_serie']}', {$serie["ref_cod_curso"]}, {$arr}, '{$serie["intervalo"]}' );\n";
353   - }
354   - else
355   - {
356   - $todas_series .= "serie[serie.length] = new Array( {$serie["cod_serie"]}, '{$serie['nm_serie']}', {$serie["ref_cod_curso"]} );\n";
357   - }
358   - }
359   - }
360   - echo "<script>{$todas_series}</script>";
361   -
362   - // EDITAR
363   - if ( $this->ref_cod_curso )
364   - {
365   - $obj_serie = new clsPmieducarSerie();
366   - $obj_serie->setOrderby("nm_serie ASC");
367   - $lst_serie = $obj_serie->lista( null,null,null,$this->ref_cod_curso,null,null,null,null,null,null,null,null,1);
368   - if ( is_array( $lst_serie ) && count( $lst_serie ) )
369   - {
370   - foreach ( $lst_serie as $serie )
371   - {
372   - $opcoes_serie["{$serie["cod_serie"]}"] = $serie['nm_serie'];
373   - }
374   - }
375   - }
376   - }
377   - else
378   - {
379   - echo "<!--\nErro\nClasse clsPmieducarSerie n&atilde;o encontrada\n-->";
380   - $todas_series = array( "" => "Erro na gera&ccedil;&atilde;o" );
381   - }
382   - $this->campoLista( "ref_cod_serie", "Série", $opcoes_serie, $this->ref_cod_serie, null, null, null, null, $serie_desabilitado, $serie_obrigatorio );
383   -
384   - }
385   -
386   - if ( $get_biblioteca )
387   - {
388   - if ($ref_cod_biblioteca_ == 0 && $nivel_usuario != 1 && $nivel_usuario != 2 )
389   - {
390   - // $this->ref_cod_biblioteca = $ref_cod_biblioteca_;
391   -
392   - $this->campoOculto( "ref_cod_biblioteca", $this->ref_cod_biblioteca );
393   - }
394   - else
395   - {
396   - $qtd_bibliotecas = count($ref_cod_biblioteca_);
397   - if ( $qtd_bibliotecas == 1 && ($nivel_usuario == 4 || $nivel_usuario == 8))
398   - {
399   - $det_unica_biblioteca = array_shift($ref_cod_biblioteca_);
400   - $this->ref_cod_biblioteca = $det_unica_biblioteca["ref_cod_biblioteca"];
401   - $this->campoOculto( "ref_cod_biblioteca", $this->ref_cod_biblioteca );
402   - }
403   - else if ( $qtd_bibliotecas > 1)
404   - {
405   -
406   - $opcoes_biblioteca = array( "" => "Selecione" );
407   - if ( is_array( $ref_cod_biblioteca_ ) && count( $ref_cod_biblioteca_ ) )
408   - {
409   - foreach ($ref_cod_biblioteca_ as $biblioteca)
410   - {
411   - $obj_biblioteca = new clsPmieducarBiblioteca($biblioteca["ref_cod_biblioteca"]);
412   - $det_biblioteca = $obj_biblioteca->detalhe();
413   - $opcoes_biblioteca["{$biblioteca["ref_cod_biblioteca"]}"] = "{$det_biblioteca['nm_biblioteca']}";
414   - }
415   - }
416   - $this->campoLista( "ref_cod_biblioteca", "Biblioteca", $opcoes_biblioteca, $this->ref_cod_biblioteca,null,null,null,null,$biblioteca_desabilitado,$biblioteca_obrigatorio );
417   - }
418   - else
419   - {
420   - $opcoes_biblioteca = array( "" => "Selecione" );
421   - if( class_exists( "clsPmieducarBiblioteca" ) )
422   - {
423   - $todas_bibliotecas = "biblioteca = new Array();\n";
424   - $obj_biblioteca = new clsPmieducarBiblioteca();
425   - $obj_biblioteca->setOrderby("nm_biblioteca ASC");
426   - $lista = $obj_biblioteca->lista(null,null,null,null,null,null,null,null,null,null,null,null,1);
427   - if ( is_array( $lista ) && count( $lista ) )
428   - {
429   - foreach ( $lista as $registro )
430   - {
431   - $todas_bibliotecas .= "biblioteca[biblioteca.length] = new Array( {$registro["cod_biblioteca"]}, '{$registro['nm_biblioteca']}', '{$registro['ref_cod_escola']}', {$registro['ref_cod_instituicao']});\n";
432   - }
433   - }
434   - echo "<script>{$todas_bibliotecas}</script>";
435   -
436   - // EDITAR
437   - if ($this->ref_cod_escola || $this->ref_cod_instituicao)
438   - {
439   - $objTemp = new clsPmieducarBiblioteca();
440   - $objTemp->setOrderby("nm_biblioteca ASC");
441   - $lista = $objTemp->lista(null,$this->ref_cod_instituicao,null,null,null,null,null,null,null,null,null,null,1);
442   -
443   - if ( is_array( $lista ) && count( $lista ) )
444   - {
445   - foreach ( $lista as $registro )
446   - {
447   - $opcoes_biblioteca["{$registro['cod_biblioteca']}"] = "{$registro['nm_biblioteca']}";
448   - }
449   - }
450   - }
451   - }
452   - else
453   - {
454   - echo "<!--\nErro\nClasse clsPmieducarBiblioteca n&atilde;o encontrada\n-->";
455   - $opcoes_biblioteca = array( "" => "Erro na gera&ccedil;&atilde;o" );
456   - }
457   - $this->campoLista( "ref_cod_biblioteca", "Biblioteca", $opcoes_biblioteca, $this->ref_cod_biblioteca,null,null,null,null,$biblioteca_desabilitado,$biblioteca_obrigatorio );
458   - }
459   - }
460   -
461   - }
462   -
463   - if ( $get_cliente_tipo )
464   - {
465   - if ( class_exists( "clsPmieducarClienteTipo" ) )
466   - {
467   - $todos_cli_tpo = "cliente_tipo = new Array();\n";
468   - $obj_cli_tpo = new clsPmieducarClienteTipo();
469   - $obj_cli_tpo->setOrderby("nm_tipo ASC");
470   - $lst_cli_tpo = $obj_cli_tpo->lista( null, null, null, null, null, null, null, null, null, null, 1 );
471   - if ( is_array( $lst_cli_tpo ) && count( $lst_cli_tpo ) )
472   - {
473   - foreach ( $lst_cli_tpo as $cli_tpo )
474   - {
475   - $todos_cli_tpo .= "cliente_tipo[cliente_tipo.length] = new Array( {$cli_tpo["cod_cliente_tipo"]}, '{$cli_tpo['nm_tipo']}', '{$cli_tpo['ref_cod_biblioteca']}' );\n";
476   - }
477   - }
478   - echo "<script>{$todos_cli_tpo}</script>";
479   - }
480   - else
481   - {
482   - echo "<!--\nErro\nClasse clsPmieducarClienteTipo n&atilde;o encontrada\n-->";
483   - $opcoes_cli_tpo = array( "" => "Erro na gera&ccedil;&atilde;o" );
484   - }
485   - $opcoes_cli_tpo = array( "" => "Selecione" );
486   - if ( $this->ref_cod_biblioteca )
487   - {
488   - if ( class_exists( "clsPmieducarClienteTipo" ) )
489   - {
490   - $obj_cli_tpo = new clsPmieducarClienteTipo();
491   - $obj_cli_tpo->setOrderby("nm_tipo ASC");
492   - $lst_cli_tpo = $obj_cli_tpo->lista( null, $this->ref_cod_biblioteca, null, null, null, null, null, null, null, null, 1 );
493   - if ( is_array( $lst_cli_tpo ) && count( $lst_cli_tpo ) )
494   - {
495   - foreach ( $lst_cli_tpo as $cli_tpo )
496   - {
497   - $opcoes_cli_tpo["{$cli_tpo['cod_cliente_tipo']}"] = "{$cli_tpo['nm_tipo']}";
498   - }
499   - }
500   - }
501   - else
502   - {
503   - echo "<!--\nErro\nClasse clsPmieducarClienteTipo n&atilde;o encontrada\n-->";
504   - $opcoes_cli_tpo = array( "" => "Erro na gera&ccedil;&atilde;o" );
505   - }
506   - }
507   - $this->campoLista( "ref_cod_cliente_tipo", "Tipo do Cliente", $opcoes_cli_tpo, $this->ref_cod_cliente_tipo, null, null, null, null, $cliente_tipo_desabilitado, $cliente_tipo_obrigatorio );
508   - }
509   - if ( $get_funcao )
510   - {
511   - if ( class_exists( "clsPmieducarFuncao" ) )
512   - {
513   - $todas_funcao = "funcao = new Array();\n";
514   - $obj_funcao = new clsPmieducarFuncao();
515   - $obj_funcao->setOrderby("nm_funcao ASC");
516   - $lst_funcao = $obj_funcao->lista( null, null, null, null, null, null, null, null, null, null, 1 );
517   - if ( is_array( $lst_funcao ) && count( $lst_funcao ) )
518   - {
519   - foreach ( $lst_funcao as $funcao )
520   - {
521   - $todas_funcao .= "funcao[funcao.length] = new Array( {$funcao["cod_funcao"]}, '{$funcao['nm_funcao']}', '{$funcao['ref_cod_instituicao']}' );\n";
522   - }
523   - }
524   - echo "<script>{$todas_funcao}</script>";
525   - }
526   - else
527   - {
528   - echo "<!--\nErro\nClasse clsPmieducarFuncao n&atilde;o encontrada\n-->";
529   - $opcoes_funcao = array( "" => "Erro na gera&ccedil;&atilde;o" );
530   - }
531   - $opcoes_funcao = array( "" => "Selecione" );
532   - if ( $this->ref_cod_instituicao )
533   - {
534   - if ( class_exists( "clsPmieducarFuncao" ) )
535   - {
536   - $obj_funcao = new clsPmieducarFuncao();
537   - $obj_funcao->setOrderby("nm_funcao ASC");
538   - $lst_funcao = $obj_funcao->lista( null, null, null, null, null, null, null, null, null, null, 1, $this->ref_cod_instituicao );
539   - if ( is_array( $lst_funcao ) && count( $lst_funcao ) )
540   - {
541   - foreach ( $lst_funcao as $funcao )
542   - {
543   - $opcoes_funcao["{$funcao['cod_funcao']}"] = "{$funcao['nm_funcao']}";
544   - }
545   - }
546   - }
547   - else
548   - {
549   - echo "<!--\nErro\nClasse clsPmieducarFuncao n&atilde;o encontrada\n-->";
550   - $opcoes_funcao = array( "" => "Erro na gera&ccedil;&atilde;o" );
551   - }
552   - }
553   - $this->campoLista( "ref_cod_funcao", "Função", $opcoes_funcao, $this->ref_cod_funcao, null, null, null, null, $funcao_desabilitado, $funcao_obrigatorio );
554   - }
555   - if ( $get_turma )
556   - {
557   - $opcoes_turma = array( "" => "Selecione" );
558   - if ( class_exists( "clsPmieducarTurma" ) )
559   - {
560   - $todas_turma = "turma = new Array();\n";
561   - $obj_turma = new clsPmieducarTurma();
562   - $obj_turma->setOrderby("nm_turma ASC");
563   - $lst_turma = $obj_turma->lista( null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1 );
564   - if ( is_array( $lst_turma ) && count( $lst_turma ) )
565   - {
566   - foreach ( $lst_turma as $turma )
567   - {
568   - $todas_turma .= "turma[turma.length] = new Array( {$turma["cod_turma"]}, '{$turma['nm_turma']}', '{$turma['ref_ref_cod_serie']}', '{$turma["ref_ref_cod_escola"]}', '{$turma["ref_cod_curso"]}' );\n";
569   - }
570   - }
571   - echo "<script>{$todas_turma}</script>";
572   -
573   - // EDITAR
574   - if ( ($this->ref_ref_cod_serie && $this->ref_cod_escola) || $this->ref_cod_curso )
575   - {
576   - $obj_turma = new clsPmieducarTurma();
577   - $obj_turma->setOrderby("nm_turma ASC");
578   - $lst_turma = $obj_turma->lista( null, null, null, $this->ref_ref_cod_serie, $this->ref_cod_escola, null, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, $this->ref_cod_curso );
579   - if ( is_array( $lst_turma ) && count( $lst_turma ) )
580   - {
581   - foreach ( $lst_turma as $turma )
582   - {
583   - $opcoes_turma["{$turma['cod_turma']}"] = "{$turma['nm_turma']}";
584   - }
585   - }
586   - }
587   - }
588   - else
589   - {
590   - echo "<!--\nErro\nClasse clsPmieducarTurma n&atilde;o encontrada\n-->";
591   - $opcoes_turma = array( "" => "Erro na gera&ccedil;&atilde;o" );
592   - }
593   - $this->campoLista( "ref_cod_turma", "Turma", $opcoes_turma, $this->ref_cod_turma, null, null, null, null, $turma_desabilitado, $turma_obrigatorio );
594   - }
595   - if (isset($get_cabecalho))
596   - {
597   - if ( $qtd_bibliotecas > 1 && ($nivel_usuario == 4 || $nivel_usuario == 8) )
598   - ${$get_cabecalho}[] = "Biblioteca";
599   - else if ($nivel_usuario == 1 || $nivel_usuario == 2 || $nivel_usuario == 4)
600   - ${$get_cabecalho}[] = "Biblioteca";
601   - if ($nivel_usuario == 1 || $nivel_usuario == 2)
602   - ${$get_cabecalho}[] = "Escola";
603   - if ($nivel_usuario == 1)
604   - ${$get_cabecalho}[] = "Institui&ccedil;&atilde;o";
605   - }
606   -?>
607   -<script>
608   -<?
609   -if ( $nivel_usuario == 1 || $nivel_usuario == 2 || $cad_usuario )
610   -{
611   -?>
612   -//caso seja preciso executar uma funcao no onchange da instituicao adicionar uma funcao as seguintes variaveis no arquivo
613   -//que precisar , assim, toda vez que for chamada a funcao serao executadas estas funcoes
614   - var before_getEscola = function(){}
615   - var after_getEscola = function(){}
616   -
617   - function getEscola()
618   - {
619   - before_getEscola();
620   -
621   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
622   - if ( document.getElementById('ref_cod_escola') )
623   - {
624   - var campoEscola = document.getElementById('ref_cod_escola');
625   - }
626   - if ( document.getElementById('ref_ref_cod_escola') )
627   - {
628   - document.getElementById('ref_ref_cod_escola').disabled = false;
629   - var campoEscola = document.getElementById('ref_ref_cod_escola');
630   - }
631   -
632   - campoEscola.length = 1;
633   - campoEscola.options[0].text = 'Selecione uma escola';
634   - campoEscola.disabled = false;
635   - for (var j = 0; j < escola.length; j++)
636   - {
637   - if (escola[j][2] == campoInstituicao)
638   - {
639   - campoEscola.options[campoEscola.options.length] = new Option( escola[j][1], escola[j][0],false,false);
640   - }
641   - }
642   - if ( campoEscola.length == 1 && campoInstituicao != '' ) {
643   - campoEscola.options[0] = new Option( 'A instituição não possui nenhuma escola', '', false, false );
644   - }
645   -
646   - after_getEscola();
647   - }
648   -<?
649   - if ($get_escola && $get_biblioteca)
650   - {
651   -?>
652   - function getDuploEscolaBiblioteca()
653   - {
654   - getEscola();
655   - getBiblioteca(1);
656   - }
657   -<?
658   - }
659   -}
660   -if ( $get_curso && $sem_padrao && !$get_matricula )
661   -{
662   -?>
663   - var before_getCurso = function(){}
664   - var after_getCurso = function(){}
665   -
666   - function getCurso()
667   - {
668   - before_getCurso();
669   -
670   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
671   - var campoCurso = document.getElementById('ref_cod_curso');
672   - campoCurso.length = 1;
673   -
674   - campoCurso.options[0].text = 'Selecione um curso';
675   - campoCurso.disabled = false;
676   - for (var j = 0; j < curso.length; j++)
677   - {
678   - if ( (curso[j][3] == campoInstituicao) && (curso[j][4] == 0) )
679   - {
680   - campoCurso.options[campoCurso.options.length] = new Option( curso[j][1], curso[j][0],false,false);
681   - }
682   - }
683   - if ( campoCurso.length == 1 && campoInstituicao != '' )
684   - {
685   - campoCurso.options[0] = new Option( 'A instituição não possui nenhum curso', '', false, false );
686   - }
687   - after_getCurso();
688   - }
689   -<?
690   -}
691   -elseif ( $get_curso && !$get_matricula )
692   -{
693   -?>
694   - var before_getCurso = function(){}
695   - var after_getCurso = function(){}
696   -
697   - function getCurso()
698   - {
699   - before_getCurso();
700   -
701   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
702   - var campoCurso = document.getElementById('ref_cod_curso');
703   -
704   - campoCurso.length = 1;
705   - campoCurso.options[0].text = 'Selecione um curso';
706   - for (var j = 0; j < curso.length; j++)
707   - {
708   - if (curso[j][3] == campoInstituicao)
709   - {
710   - campoCurso.options[campoCurso.options.length] = new Option( curso[j][1], curso[j][0],false,false);
711   - }
712   - }
713   - if ( campoCurso.length == 1 && campoInstituicao != '' ) {
714   - campoCurso.options[0] = new Option( 'A instituição não possui nenhum curso', '', false, false );
715   - }
716   - after_getCurso();
717   - }
718   -<?
719   -}
720   -if ( $get_escola && $get_curso)
721   -{
722   -?>
723   - function getDuploEscolaCurso()
724   - {
725   - getEscola();
726   - getCurso();
727   - }
728   -<?
729   -}
730   -if ( $get_escola_curso )
731   -{
732   -?>
733   - var before_getEscolaCurso = function(){}
734   - var after_getEscolaCurso = function(){}
735   -
736   - function getEscolaCurso()
737   - {
738   - before_getEscolaCurso();
739   -
740   - if ( document.getElementById('ref_cod_escola') )
741   - {
742   - var campoEscola = document.getElementById('ref_cod_escola').value;
743   - }
744   - else if ( document.getElementById('ref_ref_cod_escola') )
745   - {
746   - var campoEscola = document.getElementById('ref_ref_cod_escola').value;
747   - }
748   - var campoCurso = document.getElementById('ref_cod_curso');
749   -
750   - campoCurso.length = 1;
751   - campoCurso.options[0] = new Option( 'Selecione um curso', '', false, false );
752   - for (var j = 0; j < escola_curso.length; j++)
753   - {
754   - if (escola_curso[j][2] == campoEscola)
755   - {
756   - campoCurso.options[campoCurso.options.length] = new Option( escola_curso[j][1], escola_curso[j][0],false,false);
757   - }
758   - }
759   - if ( campoCurso.length == 1 && campoEscola != '' ) {
760   - campoCurso.options[0] = new Option( 'A escola não possui nenhum curso', '', false, false );
761   - }
762   -
763   - after_getEscolaCurso();
764   - }
765   -<?
766   -}
767   -if ( $get_escola_curso_serie && $get_matricula )
768   -{
769   -?>
770   - var before_getEscolaCursoSerie= function(){}
771   - var after_getEscolaCursoSerie = function(){}
772   -
773   - function getEscolaCursoSerie()
774   - {
775   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
776   - var campoEscola = document.getElementById('ref_cod_escola').value;
777   - var campoCurso = document.getElementById('ref_cod_curso').value;
778   - var campoSerie = document.getElementById('ref_ref_cod_serie');
779   -
780   - before_getEscolaCursoSerie();
781   -
782   - campoSerie.length = 1;
783   - campoSerie.options[0] = new Option( 'Selecione uma série', '', false, false );
784   - if ( matriculas.length )
785   - {
786   - var instituicao_igual = false;
787   - for (var j = 0; j < matriculas.length; j++)
788   - {
789   - if ( matriculas[j][13] == campoInstituicao )
790   - {
791   - instituicao_igual = true;
792   - // caso a (matricula_escola seja == a escola_escolhida) e ( (matricula_escola siga o padrao_escola) e (escola_ano_letivo > ano_matricula) ou (matricula_escola NAO siga o padrao_escola) )
793   - if ( (matriculas[j][1] == campoEscola) && ( ( ( (matriculas[j][11] == 1) && (matriculas[j][10] > matriculas[j][9]) ) ) || (matriculas[j][11] != 1) ) )
794   - {
795   - // caso curso_escolhido == curso_matricula
796   - if (matriculas[j][2] == campoCurso)
797   - {
798   - // foi reprovado na serie
799   - if (matriculas[j][5] == 2)
800   - {
801   - // exibe a mesma serie
802   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][4], matriculas[j][3],false,false);
803   - }
804   - // foi aprovado na serie
805   - else if (matriculas[j][5] == 1)
806   - {
807   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
808   - {
809   - if(matriculas[j][6][ct] == campoCurso)
810   - {
811   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
812   - }
813   - }
814   - }
815   - } // caso curso_escolhido seja !
816   - else
817   - {
818   - // foi aprovado na serie
819   - if (matriculas[j][5] == 1)
820   - {
821   - // exibe somente a serie da sequencia do curso_escolhido
822   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
823   - {
824   - if (matriculas[j][6][ct] == campoCurso)
825   - {
826   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
827   - }
828   - }
829   - }
830   - // foi aprovado, reprovado ou esta em andamento na serie
831   - if ( (matriculas[j][5] == 1) || (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
832   - {
833   -// alert('aprovado == 1 || 2 || 3');
834   - var pertence_sequencia = false;
835   - var achou_serie_mat = false;
836   - var aux_serie;
837   - var ini_serie;
838   -
839   - for (var i = 0; i < ini_sequencia.length; i++)
840   - {
841   - ini_serie = ini_sequencia[i][0];
842   - var s = 0;
843   -
844   - while ( s < sequencia.length )
845   - {
846   - aux_serie = sequencia[s][1];
847   -
848   - if (ini_serie == aux_serie)
849   - {
850   - if (matriculas[j][3] == aux_serie)
851   - {
852   -// alert('achou serie matricula');
853   - achou_serie_mat = true;
854   - }
855   - if (sequencia[s][0] == campoCurso)
856   - {
857   -// alert('pertence sequencia ');
858   - pertence_sequencia = true;
859   - }
860   - else if (sequencia[s][2] == campoCurso)
861   - {
862   -// alert('pertence sequencia ');
863   - pertence_sequencia = true;
864   - }
865   - else
866   - {
867   - ini_serie = sequencia[s][3];
868   - s = -1;
869   - }
870   - }
871   - s++;
872   - }
873   - if (achou_serie_mat && pertence_sequencia)
874   - {
875   - break;
876   - }
877   - }
878   - if (achou_serie_mat && !pertence_sequencia)
879   - {
880   -// alert('nao pertence sequencia ');
881   - for (var i = 0; i < serie.length; i++)
882   - {
883   - if ( (serie[i][2] == campoEscola) && (serie[i][3] == campoCurso) )
884   - {
885   - campoSerie.options[campoSerie.options.length] = new Option( serie[i][1], serie[i][0],false,false);
886   - }
887   - }
888   -// if ( campoSerie.options.length == 1 )
889   -// {
890   -// campoSerie.options[0] = new Option( 'Nenhuma série disponível', '', false, false );
891   -// }
892   - }
893   - }
894   - }
895   - }
896   - // caso a (escola_matricula seja ! da escola_escolhida) e (exista uma solicitacao_transferencia)
897   - else if ( (matriculas[j][1] != campoEscola) && (matriculas[j][12] == 1) )
898   - {
899   -// alert('escola !');
900   - // caso curso_escolhido == curso_matricula
901   - if (matriculas[j][2] == campoCurso)
902   - {
903   - // foi (reprovado na serie) ou (esta em andamento)
904   - if ( (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
905   - {
906   - // exibe a mesma serie
907   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][4], matriculas[j][3],false,false);
908   - }
909   - // foi aprovado na serie
910   - else if (matriculas[j][5] == 1)
911   - {
912   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
913   - {
914   - // alert(matriculas[j][6]);
915   - if(matriculas[j][6][ct] == campoCurso)
916   - {
917   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
918   - }
919   - }
920   - }
921   - }// caso curso_escolhido seja !
922   - else
923   - {
924   - // foi aprovado na serie
925   - if (matriculas[j][5] == 1)
926   - {
927   - // exibe somente a serie da sequencia do curso_escolhido
928   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
929   - {
930   - if (matriculas[j][6][ct] == campoCurso)
931   - {
932   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
933   - }
934   - }
935   - }
936   - // foi aprovado, reprovado ou esta em andamento na serie
937   - if ( (matriculas[j][5] == 1) || (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
938   - {
939   -// alert('aprovado == 1 || 2 || 3');
940   - var pertence_sequencia = false;
941   - var achou_serie_mat = false;
942   - var aux_serie;
943   - var ini_serie;
944   -
945   - for (var i = 0; i < ini_sequencia.length; i++)
946   - {
947   - ini_serie = ini_sequencia[i][0];
948   - var s = 0;
949   -
950   - while ( s < sequencia.length )
951   - {
952   - aux_serie = sequencia[s][1];
953   -
954   - if (ini_serie == aux_serie)
955   - {
956   - if (matriculas[j][3] == aux_serie)
957   - {
958   -// alert('achou serie matricula');
959   - achou_serie_mat = true;
960   - }
961   - if (sequencia[s][0] == campoCurso)
962   - {
963   -// alert('pertence sequencia ');
964   - pertence_sequencia = true;
965   - }
966   - else if (sequencia[s][2] == campoCurso)
967   - {
968   -// alert('pertence sequencia ');
969   - pertence_sequencia = true;
970   - }
971   - else
972   - {
973   - ini_serie = sequencia[s][3];
974   - s = -1;
975   - }
976   - }
977   - s++;
978   - }
979   - if (achou_serie_mat && pertence_sequencia)
980   - {
981   - break;
982   - }
983   - }
984   - if (achou_serie_mat && !pertence_sequencia)
985   - {
986   -// alert('nao pertence sequencia ');
987   - for (var i = 0; i < serie.length; i++)
988   - {
989   - if ( (serie[i][2] == campoEscola) && (serie[i][3] == campoCurso) )
990   - {
991   - campoSerie.options[campoSerie.options.length] = new Option( serie[i][1], serie[i][0],false,false);
992   - }
993   - }
994   - }
995   - }
996   - }
997   - }
998   - // independente da escola
999   - else
1000   - {
1001   -// alert('independente da escola');
1002   - // caso curso_escolhido seja ! curso_matricula
1003   - if (matriculas[j][2] != campoCurso)
1004   - {
1005   - // foi aprovado, reprovado ou esta em andamento na serie
1006   - if ( (matriculas[j][5] == 1) || (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
1007   - {
1008   -// alert('aprovado == 1 || 2 || 3');
1009   - var pertence_sequencia = false;
1010   - var achou_serie_mat = false;
1011   - var aux_serie;
1012   - var ini_serie;
1013   -
1014   - for (var i = 0; i < ini_sequencia.length; i++)
1015   - {
1016   - ini_serie = ini_sequencia[i][0];
1017   -
1018   - var s = 0;
1019   - while ( s < sequencia.length )
1020   - {
1021   - aux_serie = sequencia[s][1];
1022   -
1023   - if (ini_serie == aux_serie)
1024   - {
1025   - if (matriculas[j][3] == aux_serie)
1026   - {
1027   -// alert('achou serie matricula');
1028   - achou_serie_mat = true;
1029   - }
1030   - if (sequencia[s][0] == campoCurso)
1031   - {
1032   -// alert('pertence sequencia ');
1033   - pertence_sequencia = true;
1034   - }
1035   - else if (sequencia[s][2] == campoCurso)
1036   - {
1037   -// alert('pertence sequencia ');
1038   - pertence_sequencia = true;
1039   - }
1040   - else
1041   - {
1042   - ini_serie = sequencia[s][3];
1043   - s = -1;
1044   - }
1045   - }
1046   - s++;
1047   - }
1048   - if (achou_serie_mat && pertence_sequencia)
1049   - {
1050   - break;
1051   - }
1052   - }
1053   - //modificado 190906
1054   - if ((achou_serie_mat && !pertence_sequencia) || (!achou_serie_mat && !pertence_sequencia))
1055   - {
1056   -// alert('nao pertence sequencia ');
1057   - for (var i = 0; i < serie.length; i++)
1058   - {
1059   - if ( (serie[i][2] == campoEscola) && (serie[i][3] == campoCurso) )
1060   - {
1061   - campoSerie.options[campoSerie.options.length] = new Option( serie[i][1], serie[i][0],false,false);
1062   - }
1063   - }
1064   - }
1065   - }
1066   - }
1067   - }
1068   - }
1069   - }
1070   - // caso o aluno n tenha nenhuma matricula na instituicao escolhida, eh liberado para c matricular em qq serie
1071   - if ( !instituicao_igual )
1072   - {
1073   - for (var j = 0; j < serie.length; j++)
1074   - {
1075   - if ( (serie[j][2] == campoEscola) && (serie[j][3] == campoCurso) )
1076   - {
1077   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1078   - }
1079   - }
1080   - if ( campoSerie.options.length == 1 )
1081   - {
1082   - campoSerie.options[0] = new Option( 'Nenhuma série disponível', '', false, false );
1083   - }
1084   - }
1085   - }
1086   - else // caso o aluno ainda n possua nenhuma matricula, eh liberado para c matricular em qq serie
1087   - {
1088   - for (var j = 0; j < serie.length; j++)
1089   - {
1090   - if ( (serie[j][2] == campoEscola) && (serie[j][3] == campoCurso) )
1091   - {
1092   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1093   - }
1094   - }
1095   - if ( campoSerie.options.length == 1 )
1096   - {
1097   - campoSerie.options[0] = new Option( 'Nenhuma série disponível', '', false, false );
1098   - }
1099   - }
1100   -
1101   - after_getEscolaCursoSerie();
1102   - }
1103   -<?
1104   -}
1105   -if ( $get_escola_curso_serie && !$get_matricula )
1106   -{
1107   -?>
1108   - var before_getEscolaCursoSerie= function(){}
1109   - var after_getEscolaCursoSerie = function(){}
1110   -
1111   - function getEscolaCursoSerie()
1112   - {
1113   - var campoEscola = document.getElementById('ref_cod_escola').value;
1114   - var campoCurso = document.getElementById('ref_cod_curso').value;
1115   - var campoSerie = document.getElementById('ref_ref_cod_serie');
1116   -
1117   - before_getEscolaCursoSerie();
1118   -
1119   - campoSerie.length = 1;
1120   - campoSerie.options[0] = new Option( 'Selecione uma série', '', false, false );
1121   - for (var j = 0; j < serie.length; j++)
1122   - {
1123   - if ((serie[j][2] == campoEscola) && (serie[j][3] == campoCurso))
1124   - {
1125   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1126   - }
1127   - }
1128   - if ( campoSerie.length == 1 && campoCurso != '' ) {
1129   - campoSerie.options[0] = new Option( 'O curso não possui nenhuma série', '', false, false );
1130   - }
1131   -
1132   - after_getEscolaCursoSerie();
1133   - }
1134   -<?
1135   -}
1136   -if ( $get_serie && $get_escola_serie )
1137   -{
1138   -?>
1139   -
1140   - var before_getSerie= function(){}
1141   - var after_getSerie = function(){}
1142   -
1143   - function getSerie()
1144   - {
1145   - var campoEscola = document.getElementById('ref_cod_escola').value;
1146   - var campoCurso = document.getElementById('ref_cod_curso').value;
1147   - var campoSerie = document.getElementById('ref_cod_serie');
1148   -
1149   - before_getSerie();
1150   -
1151   - campoSerie.length = 1;
1152   - for (var j = 0; j < serie.length; j++)
1153   - {
1154   - if (serie[j][2] == campoCurso)
1155   - {
1156   - var achou = false;
1157   - for(var ct = 0;ct < serie[j][3].length;ct++)
1158   - {
1159   - if(serie[j][3][ct] == campoEscola){
1160   - achou = true;
1161   - break;
1162   - }
1163   - }
1164   -
1165   - if(!achou)
1166   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1167   - }
1168   - }
1169   -
1170   - after_getSerie();
1171   - }
1172   -<?
1173   -}
1174   -if ( $get_serie && !$get_escola_serie )
1175   -{
1176   -?>
1177   - function getSerie()
1178   - {
1179   - var campoCurso = document.getElementById('ref_cod_curso').value;
1180   - var campoSerie = document.getElementById('ref_cod_serie');
1181   -
1182   - campoSerie.length = 1;
1183   - for (var j = 0; j < serie.length; j++)
1184   - {
1185   - if (serie[j][2] == campoCurso)
1186   - {
1187   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1188   - }
1189   - }
1190   - }
1191   -<?
1192   -}
1193   -if ( $get_biblioteca )
1194   -{
1195   -?>
1196   - var before_getBiblioteca = function(){}
1197   - var after_getBiblioteca = function(){}
1198   -
1199   - function getBiblioteca(flag)
1200   - {
1201   - before_getBiblioteca();
1202   -
1203   - var campoBiblioteca = document.getElementById('ref_cod_biblioteca');
1204   -
1205   - campoBiblioteca.length = 1;
1206   - campoBiblioteca.options[0].text = 'Selecione uma biblioteca';
1207   - if (flag == 1)
1208   - {
1209   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
1210   - for (var j = 0; j < biblioteca.length; j++)
1211   - {
1212   - if (biblioteca[j][3] == campoInstituicao)
1213   - {
1214   - campoBiblioteca.options[campoBiblioteca.options.length] = new Option( biblioteca[j][1], biblioteca[j][0],false,false);
1215   - }
1216   - }
1217   - if ( campoBiblioteca.length == 1 && campoInstituicao != '' )
1218   - campoBiblioteca.options[0] = new Option( 'A instituição não possui nenhuma biblioteca', '', false, false );
1219   - }
1220   - else if (flag == 2)
1221   - {
1222   - var campoEscola = document.getElementById('ref_cod_escola').value;
1223   - for (var j = 0; j < biblioteca.length; j++)
1224   - {
1225   - if (biblioteca[j][2] == campoEscola)
1226   - {
1227   - campoBiblioteca.options[campoBiblioteca.options.length] = new Option( biblioteca[j][1], biblioteca[j][0],false,false);
1228   - }
1229   - }
1230   - if ( campoBiblioteca.length == 1 && campoEscola != '' )
1231   - campoBiblioteca.options[0] = new Option( 'A escola não possui nenhuma biblioteca', '', false, false );
1232   - }
1233   -
1234   - after_getBiblioteca();
1235   - }
1236   -<?
1237   -}
1238   -if ( $get_cliente_tipo )
1239   -{
1240   -?>
1241   - var before_getClienteTipo = function(){}
1242   - var after_getClienteTipo = function(){}
1243   -
1244   - function getClienteTipo()
1245   - {
1246   - before_getClienteTipo();
1247   -
1248   - var campoBiblioteca = document.getElementById( 'ref_cod_biblioteca' ).value;
1249   - var campoClienteTipo = document.getElementById( 'ref_cod_cliente_tipo' );
1250   -
1251   - campoClienteTipo.length = 1;
1252   - campoClienteTipo.options[0] = new Option( 'Selecione um tipo de cliente', '', false, false );
1253   - for (var j = 0; j < cliente_tipo.length; j++)
1254   - {
1255   - if ( ( cliente_tipo[j][2] == campoBiblioteca ) )
1256   - {
1257   - campoClienteTipo.options[campoClienteTipo.options.length] = new Option( cliente_tipo[j][1], cliente_tipo[j][0], false, false );
1258   - }
1259   - }
1260   - if ( campoClienteTipo.length == 1 && campoBiblioteca != '' ) {
1261   - campoClienteTipo.options[0] = new Option( 'A biblioteca não possui nenhum tipo de cliente', '', false, false );
1262   - }
1263   -
1264   - after_getClienteTipo();
1265   - }
1266   -<?
1267   -}
1268   -if ( $get_funcao )
1269   -{
1270   -?>
1271   - var before_getFuncao = function(){}
1272   - var after_getFuncao = function(){}
1273   -
1274   - function getFuncao()
1275   - {
1276   - before_getFuncao();
1277   -
1278   - var campoInstituicao = document.getElementById( 'ref_cod_instituicao' ).value;
1279   - var campoFuncao = document.getElementById( 'ref_cod_funcao' );
1280   -
1281   - campoFuncao.length = 1;
1282   - campoFuncao.options[0] = new Option( 'Selecione uma Função', '', false, false );
1283   - for (var j = 0; j < funcao.length; j++)
1284   - {
1285   - if ( ( funcao[j][2] == campoInstituicao ) )
1286   - {
1287   - campoFuncao.options[campoFuncao.options.length] = new Option( funcao[j][1], funcao[j][0], false, false );
1288   - }
1289   - }
1290   - if ( campoFuncao.length == 1 && campoInstituicao != '' ) {
1291   - campoFuncao.options[0] = new Option( 'A instituição não possui nenhuma função', '', false, false );
1292   - }
1293   -
1294   - after_getFuncao();
1295   - }
1296   -<?
1297   -}
1298   -if ( $get_turma )
1299   -{
1300   -?>
1301   - var before_getTurma = function(){}
1302   - var after_getTurma = function(){}
1303   -
1304   - function getTurma()
1305   - {
1306   - before_getTurma();
1307   -
1308   - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;
1309   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
1310   - var campoTurma = document.getElementById( 'ref_cod_turma' );
1311   -
1312   - campoTurma.length = 1;
1313   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
1314   - for ( var j = 0; j < turma.length; j++ )
1315   - {
1316   - if ( ( turma[j][2] == campoSerie ) && ( turma[j][3] == campoEscola ) )
1317   - {
1318   - campoTurma.options[campoTurma.options.length] = new Option( turma[j][1], turma[j][0], false, false );
1319   - }
1320   - }
1321   - if ( campoTurma.length == 1 && campoSerie != '' ) {
1322   - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false );
1323   - }
1324   -
1325   - after_getTurma();
1326   - }
1327   -<?
1328   -}
1329   -
1330   -?>
1331   -
1332   -</script>
1333 0 \ No newline at end of file
ieducar/intranet/include/pmieducar/educar_campo_lista_old.php
... ... @@ -1,1350 +0,0 @@
1   -<?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   -* *
4   -* @author Prefeitura Municipal de Itajaí *
5   -* @updated 29/03/2007 *
6   -* Pacote: i-PLB Software Público Livre e Brasileiro *
7   -* *
8   -* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   -* ctima@itajai.sc.gov.br *
10   -* *
11   -* Este programa é software livre, você pode redistribuí-lo e/ou *
12   -* modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   -* publicada pela Free Software Foundation, tanto a versão 2 da *
14   -* Licença como (a seu critério) qualquer versão mais nova. *
15   -* *
16   -* Este programa é distribuído na expectativa de ser útil, mas SEM *
17   -* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   -* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   -* sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   -* *
21   -* Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   -* junto com este programa. Se não, escreva para a Free Software *
23   -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   -* 02111-1307, USA. *
25   -* *
26   -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   - if(!isset($exibe_campo_lista_curso_escola))
28   - {
29   - $exibe_campo_lista_curso_escola = true;
30   - }
31   -
32   - if ($obrigatorio)
33   - {
34   - $instituicao_obrigatorio = $escola_obrigatorio = $curso_obrigatorio = $escola_curso_obrigatorio = $escola_curso_serie_obrigatorio = $serie_obrigatorio = $biblioteca_obrigatorio = $cliente_tipo_obrigatorio = $funcao_obrigatorio = $turma_obrigatorio = true;
35   - }
36   - else
37   - {
38   - $instituicao_obrigatorio = isset($instituicao_obrigatorio) ? $instituicao_obrigatorio : false;
39   - $escola_obrigatorio = isset($escola_obrigatorio) ? $escola_obrigatorio : false;
40   - $curso_obrigatorio = isset($curso_obrigatorio) ? $curso_obrigatorio : false;
41   - $escola_curso_obrigatorio = isset($escola_curso_obrigatorio) ? $escola_curso_obrigatorio : false;
42   - $escola_curso_serie_obrigatorio = isset($escola_curso_serie_obrigatorio) ? $escola_curso_serie_obrigatorio : false;
43   - $serie_obrigatorio = isset($serie_obrigatorio) ? $serie_obrigatorio : false;
44   - $biblioteca_obrigatorio = isset($biblioteca_obrigatorio) ? $biblioteca_obrigatorio : false;
45   - $cliente_tipo_obrigatorio = isset( $cliente_tipo_obrigatorio ) ? $cliente_tipo_obrigatorio : false;
46   - $funcao_obrigatorio = isset( $funcao_obrigatorio ) ? $funcao_obrigatorio : false;
47   - $turma_obrigatorio = isset( $turma_obrigatorio ) ? $turma_obrigatorio : false;
48   - }
49   -
50   - if ($desabilitado)
51   - {
52   - $instituicao_desabilitado = $escola_desabilitado = $curso_desabilitado = $escola_curso_desabilitado = $escola_curso_serie_desabilitado = $serie_desabilitado = $biblioteca_desabilitado = $cliente_tipo_desabilitado = $turma_desabilitado = true;
53   - }
54   - else
55   - {
56   - $instituicao_desabilitado = isset($instituicao_desabilitado) ? $instituicao_desabilitado : false;
57   - $escola_desabilitado = isset($escola_desabilitado) ? $escola_desabilitado : false;
58   - $curso_desabilitado = isset($curso_desabilitado) ? $curso_desabilitado : false;
59   - $escola_curso_desabilitado = isset($escola_curso_desabilitado) ? $escola_curso_desabilitado : false;
60   - $escola_curso_serie_desabilitado = isset($escola_curso_serie_desabilitado) ? $escola_curso_serie_desabilitado : false;
61   - $serie_desabilitado = isset($serie_desabilitado) ? $serie_desabilitado : false;
62   - $biblioteca_desabilitado = isset($biblioteca_desabilitado) ? $biblioteca_desabilitado : false;
63   - $cliente_tipo_desabilitado = isset( $cliente_tipo_desabilitado ) ? $cliente_tipo_desabilitado : false;
64   - $funcao_desabilitado = isset( $funcao_desabilitado ) ? $funcao_desabilitado : false;
65   - $turma_desabilitado = isset( $turma_desabilitado ) ? $turma_desabilitado : false;
66   - }
67   -
68   - $obj_permissoes = new clsPermissoes();
69   - $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
70   -
71   - if( $nivel_usuario == 1 || $cad_usuario )
72   - {
73   - $opcoes = array( "" => "Selecione" );
74   - $obj_instituicao = new clsPmieducarInstituicao();
75   - $obj_instituicao->setCamposLista("cod_instituicao, nm_instituicao");
76   - $obj_instituicao->setOrderby("nm_instituicao ASC");
77   - $lista = $obj_instituicao->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,1);
78   - if ( is_array( $lista ) && count( $lista ) )
79   - {
80   - foreach ( $lista as $registro )
81   - {
82   - $opcoes["{$registro['cod_instituicao']}"] = "{$registro['nm_instituicao']}";
83   - }
84   - }
85   -
86   - if ($get_escola && $get_biblioteca)
87   - {
88   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getDuplo();",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
89   - }
90   - else if ($get_escola && $get_curso )
91   - {
92   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao, "getDuploEscolaCurso();", null, null, null, $instituicao_desabilitado, $instituicao_obrigatorio );
93   - }
94   - else if ($get_escola)
95   - {
96   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getEscola();",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
97   - }
98   - else if ($get_curso)
99   - {
100   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getCurso();",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
101   - }
102   - else if ($get_biblioteca)
103   - {
104   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"getBiblioteca(1);",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
105   - }
106   - else if ( $get_cliente_tipo )
107   - {
108   - $this->campoLista( "ref_cod_cliente_tipo", "Tipo de Cliente", $opcoes, $this->ref_cod_cliente_tipo, "getCliente();", null, null, null, $cliente_tipo_desabilitado, $cliente_tipo_obrigatorio );
109   - }
110   - else
111   - {
112   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao,"",null,null,null,$instituicao_desabilitado,$instituicao_obrigatorio);
113   - }
114   - }
115   - elseif ( $nivel_usuario != 1 )
116   - {
117   - $obj_usuario = new clsPmieducarUsuario($this->pessoa_logada);
118   - $det_usuario = $obj_usuario->detalhe();
119   - $this->ref_cod_instituicao = $det_usuario["ref_cod_instituicao"];
120   - $this->campoOculto( "ref_cod_instituicao", $this->ref_cod_instituicao );
121   - if ($nivel_usuario == 4 || $nivel_usuario == 8)
122   - {
123   - $obj_usuario = new clsPmieducarUsuario($this->pessoa_logada);
124   - $det_usuario = $obj_usuario->detalhe();
125   - $this->ref_cod_escola = $det_usuario["ref_cod_escola"];
126   - $this->campoOculto( "ref_cod_escola", $this->ref_cod_escola );
127   - if($exibe_nm_escola == true)
128   - {
129   - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
130   - $det_escola = $obj_escola->detalhe();
131   - $nm_escola = $det_escola['nome'];
132   - $this->campoRotulo( "nm_escola","Escola", $nm_escola );
133   - }
134   - if ( $get_biblioteca )
135   - {
136   - $obj_per = new clsPermissoes();
137   - $ref_cod_biblioteca_ = $obj_per->getBiblioteca( $this->pessoa_logada );
138   -
139   - }
140   - }
141   - }
142   -
143   - if ( $get_escola && ( $nivel_usuario == 1 || $nivel_usuario == 2 || $cad_usuario ) )
144   - {
145   - $opcoes_escola = array( "" => "Selecione uma escola" );
146   - $todas_escolas = "escola = new Array();\n";
147   - $obj_escola = new clsPmieducarEscola();
148   - $obj_escola->setOrderby("nome ASC");
149   - $lista = $obj_escola->lista(null,null,null,null,null,null,null,null,null,null,1);
150   - if ( is_array( $lista ) && count( $lista ) )
151   - {
152   - foreach ( $lista as $registro )
153   - {
154   - $todas_escolas .= "escola[escola.length] = new Array( {$registro["cod_escola"]}, '{$registro['nome']}', {$registro["ref_cod_instituicao"]} );\n";
155   - }
156   - }
157   - echo "<script>{$todas_escolas}</script>";
158   -
159   - // EDITAR
160   - if ($this->ref_cod_instituicao)
161   - {
162   - $obj_escola = new clsPmieducarEscola();
163   - $obj_escola->setOrderby("nome ASC");
164   - $lista = $obj_escola->lista(null,null,null,$this->ref_cod_instituicao,null,null,null,null,null,null,1);
165   - if ( is_array( $lista ) && count( $lista ) )
166   - {
167   - foreach ( $lista as $registro )
168   - {
169   - $opcoes_escola["{$registro["cod_escola"]}"] = "{$registro['nome']}";
170   - }
171   - }
172   - }
173   -
174   - if ($get_biblioteca)
175   - {
176   - $this->campoLista( "ref_cod_escola", "Escola", $opcoes_escola, $this->ref_cod_escola,"getBiblioteca(2);",null,null,null,$escola_desabilitado,$escola_obrigatorio );
177   - }
178   - else
179   - {
180   - $this->campoLista( "ref_cod_escola", "Escola", $opcoes_escola, $this->ref_cod_escola,null,null,null,null,$escola_desabilitado,$escola_obrigatorio );
181   - }
182   - }
183   -
184   - if ( $get_escola_curso )
185   - {
186   - $todos_cursos = "curso = new Array();\n";
187   - $obj_curso = new clsPmieducarCurso();
188   - $obj_curso->setOrderby("nm_curso ASC");
189   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1);
190   - if ( is_array( $lista ) && count( $lista ) )
191   - {
192   - foreach ( $lista as $registro )
193   - {
194   - $todos_cursos .= "curso[curso.length] = new Array( {$registro["cod_curso"]}, '{$registro['nm_curso']}', {$registro['qtd_etapas']}, {$registro["ref_cod_instituicao"]}, {$registro["padrao_ano_escolar"]} );\n";
195   - }
196   - }
197   - echo "<script>{$todos_cursos}</script>";
198   -
199   -
200   -
201   - $opcoes_cursos_escola = array( "" => "Selecione" );
202   - $todos_cursos_escola = "escola_curso = new Array();\n";
203   - $obj_escola_curso = new clsPmieducarEscolaCurso();
204   -// $obj_escola_curso->setOrderby("ref_cod_curso ASC");
205   - $lst_escola_curso = $obj_escola_curso->lista( null,null,null,null,null,null,null,null,1 );
206   - if ( is_array( $lst_escola_curso ) && count( $lst_escola_curso ) )
207   - {
208   - foreach ( $lst_escola_curso as $escola_curso )
209   - {
210   - //$obj_curso = new clsPmieducarCurso( $escola_curso["ref_cod_curso"] );
211   - //$det_curso = $obj_curso->he();
212   - if(isset($curso_padrao_ano_escolar) && $det_curso['padrao_ano_escolar'] != $curso_padrao_ano_escolar)
213   - continue;
214   - $todos_cursos_escola .= "escola_curso[escola_curso.length] = new Array( {$escola_curso["ref_cod_curso"]}, '{$escola_curso['nm_curso']}', {$escola_curso["ref_cod_escola"]}, {$escola_curso["padrao_ano_escolar"]} );\n";
215   - }
216   - }
217   - echo "<script>{$todos_cursos_escola}</script>";
218   -
219   - // EDITAR
220   - if ( $this->ref_cod_escola )
221   - {
222   - $obj_escola_curso = new clsPmieducarEscolaCurso();
223   -// $obj_escola_curso->setOrderby("ref_cod_curso ASC");
224   -
225   - $lst_escola_curso = $obj_escola_curso->lista( $this->ref_cod_escola,null,null,null,null,null,null,null,1 );
226   -
227   - if ( is_array( $lst_escola_curso ) && count( $lst_escola_curso ) )
228   - {
229   - foreach ( $lst_escola_curso as $escola_curso )
230   - {
231   - //$obj_curso = new clsPmieducarCurso( $escola_curso["ref_cod_curso"] );
232   - //$det_curso = $obj_curso->detalhe();
233   - $opcoes_cursos_escola["{$escola_curso["ref_cod_curso"]}"] = $escola_curso['nm_curso'];
234   - }
235   - }
236   - }
237   -
238   -// if(($exibe_campo_lista_curso_escola && !isset($sem_padrao)) || $this->ref_cod_escola)
239   - $this->campoLista( "ref_cod_curso", "Curso", $opcoes_cursos_escola, $this->ref_cod_curso, null, null, null, null, $escola_curso_desabilitado, $escola_curso_obrigatorio );
240   - }
241   - else if ($get_curso)
242   - {
243   - $opcoes_curso = array( "" => "Selecione" );
244   - $todos_cursos = "curso = new Array();\n";
245   - $obj_curso = new clsPmieducarCurso();
246   - $obj_curso->setOrderby("nm_curso ASC");
247   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1);
248   - if ( is_array( $lista ) && count( $lista ) )
249   - {
250   - foreach ( $lista as $registro )
251   - {
252   - $todos_cursos .= "curso[curso.length] = new Array( {$registro["cod_curso"]}, '{$registro['nm_curso']}', {$registro['qtd_etapas']}, {$registro["ref_cod_instituicao"]}, {$registro["padrao_ano_escolar"]} );\n";
253   - }
254   - }
255   - echo "<script>{$todos_cursos}</script>";
256   -
257   - // EDITAR
258   - // -->!isset
259   - if ($this->ref_cod_instituicao && (!$this->ref_cod_escola /*&& isset($sem_padrao)*/))
260   - {
261   - $opcoes_curso = array( "" => "Selecione" );
262   - $obj_curso = new clsPmieducarCurso();
263   - $obj_curso->setOrderby("nm_curso ASC");
264   -
265   - if ($sem_padrao)
266   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,$this->ref_cod_instituicao,0 );
267   - else
268   - $lista = $obj_curso->lista(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,$this->ref_cod_instituicao);
269   -
270   - if ( is_array( $lista ) && count( $lista ) )
271   - {
272   - foreach ( $lista as $registro )
273   - {
274   - $opcoes_curso["{$registro['cod_curso']}"] = "{$registro['nm_curso']}";
275   - }
276   - }
277   -
278   - }
279   -// if(!$this->ref_cod_escola && isset($sem_padrao))
280   - $this->campoLista( "ref_cod_curso", "Curso", $opcoes_curso, $this->ref_cod_curso,null,null,null,null,false,$curso_obrigatorio );
281   - }
282   -
283   - if ( $get_escola_curso_serie )
284   - {
285   -
286   - $opcoes_series_curso_escola = array( "" => "Selecione" );
287   - if( class_exists( "clsPmieducarEscolaSerie" ) && class_exists( "clsPmieducarSerie" ) )
288   - {
289   - $todas_series_curso_escola = "serie = new Array();\n";
290   - $obj_escola_serie = new clsPmieducarEscolaSerie();
291   - $obj_escola_serie->setOrderby("nm_serie ASC");
292   - $lst_escola_serie = $obj_escola_serie->lista( null,null,null,null,null,null,null,null,null,null,null,null,1 );
293   - if ( is_array( $lst_escola_serie ) && count( $lst_escola_serie ) )
294   - {
295   - foreach ( $lst_escola_serie as $escola_curso_serie )
296   - {
297   -
298   - $escola_curso_serie["hora_inicial"] = date("H:i", strtotime( $escola_curso_serie["hora_inicial"]));
299   - $escola_curso_serie["hora_final"] = date("H:i", strtotime( $escola_curso_serie["hora_final"]));
300   - $escola_curso_serie["hora_inicio_intervalo"] = date("H:i", strtotime( $escola_curso_serie["hora_inicio_intervalo"]));
301   - $escola_curso_serie["hora_fim_intervalo"] = date("H:i", strtotime( $escola_curso_serie["hora_fim_intervalo"]));
302   - //$obj_serie = new clsPmieducarSerie( $escola_curso_serie["ref_cod_serie"] );
303   - //$det_serie = $obj_serie->detalhe();
304   - $todas_series_curso_escola .= "serie[serie.length] = new Array( {$escola_curso_serie["ref_cod_serie"]}, '{$escola_curso_serie['nm_serie']}', {$escola_curso_serie["ref_cod_escola"]}, {$escola_curso_serie["ref_cod_curso"]}, '{$escola_curso_serie["hora_inicial"]}', '{$escola_curso_serie["hora_final"]}', '{$escola_curso_serie["hora_inicio_intervalo"]}', '{$escola_curso_serie["hora_fim_intervalo"]}' );\n";
305   - }
306   - }
307   - echo "<script>{$todas_series_curso_escola}</script>";
308   -
309   - // EDITAR
310   - if ( $this->ref_cod_escola && $this->ref_cod_curso )
311   - {
312   - $obj_escola_serie = new clsPmieducarEscolaSerie();
313   - $obj_escola_serie->setOrderby("nm_serie ASC");
314   - $lst_escola_serie = $obj_escola_serie->lista( $this->ref_cod_escola,null,null,null,null,null,null,null,null,null,null,null,1,null,null,null,null,null,$this->ref_cod_curso );
315   - if ( is_array( $lst_escola_serie ) && count( $lst_escola_serie ) )
316   - {
317   - foreach ( $lst_escola_serie as $escola_curso_serie )
318   - {
319   - //$obj_serie = new clsPmieducarSerie( $escola_curso_serie["ref_cod_serie"] );
320   - //$det_serie = $obj_serie->detalhe();
321   - $opcoes_series_curso_escola["{$escola_curso_serie["ref_cod_serie"]}"] = $escola_curso_serie['nm_serie'];
322   - }
323   - }
324   - }
325   - }
326   - else
327   - {
328   - echo "<!--\nErro\nClasse(s) clsPmieducarEscolaSerie / clsPmieducarSerie n&atilde;o encontrada(s)\n-->";
329   - $opcoes_series_curso_escola = array( "" => "Erro na gera&ccedil;&atilde;o" );
330   - }
331   - $this->campoLista( "ref_ref_cod_serie", "S&eacute;rie", $opcoes_series_curso_escola, $this->ref_ref_cod_serie, null, null, null, null, $escola_curso_serie_desabilitado, $escola_curso_serie_obrigatorio );
332   -
333   - }
334   -
335   - if ( $get_serie )
336   - {
337   -
338   - $opcoes_serie = array( "" => "Selecione" );
339   - if( class_exists( "clsPmieducarSerie" ) )
340   - {
341   - $todas_series = "serie = new Array();\n";
342   - $obj_serie = new clsPmieducarSerie();
343   - $obj_serie->setOrderby("nm_serie ASC");
344   - $lst_serie = $obj_serie->lista( null,null,null,null,null,null,null,null,null,null,null,null,1 );
345   -
346   - if ( is_array( $lst_serie ) && count( $lst_serie ) )
347   - {
348   - foreach ( $lst_serie as $serie )
349   - {
350   - if ($get_escola_serie)
351   - {
352   - $obj_escola_serie = new clsPmieducarEscolaSerie();
353   - $obj_escola_serie->setOrderby("nm_serie ASC");
354   - $lst_escola_serie = $obj_escola_serie->lista( null,$serie["cod_serie"],null,null,null,null,null,null,null,null,null,null,1 );
355   - if ( is_array( $lst_escola_serie ) && count( $lst_escola_serie ) )
356   - {
357   - $arr = "new Array(";
358   - $conc = "";
359   - foreach ( $lst_escola_serie as $escola_serie )
360   - {
361   - $arr .= "{$conc}'{$escola_serie["ref_cod_escola"]}'";
362   - $conc = ",";
363   - }
364   - $arr .= ")";
365   - }else
366   - {
367   - $arr = "new Array()";
368   - }
369   - $todas_series .= "serie[serie.length] = new Array( {$serie["cod_serie"]}, '{$serie['nm_serie']}', {$serie["ref_cod_curso"]}, {$arr}, '{$serie["intervalo"]}' );\n";
370   - }
371   - else
372   - {
373   - $todas_series .= "serie[serie.length] = new Array( {$serie["cod_serie"]}, '{$serie['nm_serie']}', {$serie["ref_cod_curso"]} );\n";
374   - }
375   - }
376   - }
377   - echo "<script>{$todas_series}</script>";
378   -
379   - // EDITAR
380   - if ( $this->ref_cod_curso )
381   - {
382   - $obj_serie = new clsPmieducarSerie();
383   - $obj_serie->setOrderby("nm_serie ASC");
384   - $lst_serie = $obj_serie->lista( null,null,null,$this->ref_cod_curso,null,null,null,null,null,null,null,null,1);
385   - if ( is_array( $lst_serie ) && count( $lst_serie ) )
386   - {
387   - foreach ( $lst_serie as $serie )
388   - {
389   - $opcoes_serie["{$serie["cod_serie"]}"] = $serie['nm_serie'];
390   - }
391   - }
392   - }
393   - }
394   - else
395   - {
396   - echo "<!--\nErro\nClasse clsPmieducarSerie n&atilde;o encontrada\n-->";
397   - $todas_series = array( "" => "Erro na gera&ccedil;&atilde;o" );
398   - }
399   - $this->campoLista( "ref_cod_serie", "Série", $opcoes_serie, $this->ref_cod_serie, null, null, null, null, $serie_desabilitado, $serie_obrigatorio );
400   -
401   - }
402   -
403   - if ( $get_biblioteca )
404   - {
405   - if ($ref_cod_biblioteca_ == 0 && $nivel_usuario != 1 && $nivel_usuario != 2 )
406   - {
407   - // $this->ref_cod_biblioteca = $ref_cod_biblioteca_;
408   -
409   - $this->campoOculto( "ref_cod_biblioteca", $this->ref_cod_biblioteca );
410   - }
411   - else
412   - {
413   - $qtd_bibliotecas = count($ref_cod_biblioteca_);
414   - if ( $qtd_bibliotecas == 1 && ($nivel_usuario == 4 || $nivel_usuario == 8))
415   - {
416   - $det_unica_biblioteca = array_shift($ref_cod_biblioteca_);
417   - $this->ref_cod_biblioteca = $det_unica_biblioteca["ref_cod_biblioteca"];
418   - $this->campoOculto( "ref_cod_biblioteca", $this->ref_cod_biblioteca );
419   - }
420   - else if ( $qtd_bibliotecas > 1)
421   - {
422   -
423   - $opcoes_biblioteca = array( "" => "Selecione" );
424   - if ( is_array( $ref_cod_biblioteca_ ) && count( $ref_cod_biblioteca_ ) )
425   - {
426   - foreach ($ref_cod_biblioteca_ as $biblioteca)
427   - {
428   - $obj_biblioteca = new clsPmieducarBiblioteca($biblioteca["ref_cod_biblioteca"]);
429   - $det_biblioteca = $obj_biblioteca->detalhe();
430   - $opcoes_biblioteca["{$biblioteca["ref_cod_biblioteca"]}"] = "{$det_biblioteca['nm_biblioteca']}";
431   - }
432   - }
433   - $this->campoLista( "ref_cod_biblioteca", "Biblioteca", $opcoes_biblioteca, $this->ref_cod_biblioteca,null,null,null,null,$biblioteca_desabilitado,$biblioteca_obrigatorio );
434   - }
435   - else
436   - {
437   - $opcoes_biblioteca = array( "" => "Selecione" );
438   - if( class_exists( "clsPmieducarBiblioteca" ) )
439   - {
440   - $todas_bibliotecas = "biblioteca = new Array();\n";
441   - $obj_biblioteca = new clsPmieducarBiblioteca();
442   - $obj_biblioteca->setOrderby("nm_biblioteca ASC");
443   - $lista = $obj_biblioteca->lista(null,null,null,null,null,null,null,null,null,null,null,null,1);
444   - if ( is_array( $lista ) && count( $lista ) )
445   - {
446   - foreach ( $lista as $registro )
447   - {
448   - $todas_bibliotecas .= "biblioteca[biblioteca.length] = new Array( {$registro["cod_biblioteca"]}, '{$registro['nm_biblioteca']}', '{$registro['ref_cod_escola']}', {$registro['ref_cod_instituicao']});\n";
449   - }
450   - }
451   - echo "<script>{$todas_bibliotecas}</script>";
452   -
453   - // EDITAR
454   - if ($this->ref_cod_escola || $this->ref_cod_instituicao)
455   - {
456   - $objTemp = new clsPmieducarBiblioteca();
457   - $objTemp->setOrderby("nm_biblioteca ASC");
458   - $lista = $objTemp->lista(null,$this->ref_cod_instituicao,null,null,null,null,null,null,null,null,null,null,1);
459   -
460   - if ( is_array( $lista ) && count( $lista ) )
461   - {
462   - foreach ( $lista as $registro )
463   - {
464   - $opcoes_biblioteca["{$registro['cod_biblioteca']}"] = "{$registro['nm_biblioteca']}";
465   - }
466   - }
467   - }
468   - }
469   - else
470   - {
471   - echo "<!--\nErro\nClasse clsPmieducarBiblioteca n&atilde;o encontrada\n-->";
472   - $opcoes_biblioteca = array( "" => "Erro na gera&ccedil;&atilde;o" );
473   - }
474   - $this->campoLista( "ref_cod_biblioteca", "Biblioteca", $opcoes_biblioteca, $this->ref_cod_biblioteca,null,null,null,null,$biblioteca_desabilitado,$biblioteca_obrigatorio );
475   - }
476   - }
477   -
478   - }
479   -
480   - if ( $get_cliente_tipo )
481   - {
482   - if ( class_exists( "clsPmieducarClienteTipo" ) )
483   - {
484   - $todos_cli_tpo = "cliente_tipo = new Array();\n";
485   - $obj_cli_tpo = new clsPmieducarClienteTipo();
486   - $obj_cli_tpo->setOrderby("nm_tipo ASC");
487   - $lst_cli_tpo = $obj_cli_tpo->lista( null, null, null, null, null, null, null, null, null, null, 1 );
488   - if ( is_array( $lst_cli_tpo ) && count( $lst_cli_tpo ) )
489   - {
490   - foreach ( $lst_cli_tpo as $cli_tpo )
491   - {
492   - $todos_cli_tpo .= "cliente_tipo[cliente_tipo.length] = new Array( {$cli_tpo["cod_cliente_tipo"]}, '{$cli_tpo['nm_tipo']}', '{$cli_tpo['ref_cod_biblioteca']}' );\n";
493   - }
494   - }
495   - echo "<script>{$todos_cli_tpo}</script>";
496   - }
497   - else
498   - {
499   - echo "<!--\nErro\nClasse clsPmieducarClienteTipo n&atilde;o encontrada\n-->";
500   - $opcoes_cli_tpo = array( "" => "Erro na gera&ccedil;&atilde;o" );
501   - }
502   - $opcoes_cli_tpo = array( "" => "Selecione" );
503   - if ( $this->ref_cod_biblioteca )
504   - {
505   - if ( class_exists( "clsPmieducarClienteTipo" ) )
506   - {
507   - $obj_cli_tpo = new clsPmieducarClienteTipo();
508   - $obj_cli_tpo->setOrderby("nm_tipo ASC");
509   - $lst_cli_tpo = $obj_cli_tpo->lista( null, $this->ref_cod_biblioteca, null, null, null, null, null, null, null, null, 1 );
510   - if ( is_array( $lst_cli_tpo ) && count( $lst_cli_tpo ) )
511   - {
512   - foreach ( $lst_cli_tpo as $cli_tpo )
513   - {
514   - $opcoes_cli_tpo["{$cli_tpo['cod_cliente_tipo']}"] = "{$cli_tpo['nm_tipo']}";
515   - }
516   - }
517   - }
518   - else
519   - {
520   - echo "<!--\nErro\nClasse clsPmieducarClienteTipo n&atilde;o encontrada\n-->";
521   - $opcoes_cli_tpo = array( "" => "Erro na gera&ccedil;&atilde;o" );
522   - }
523   - }
524   - $this->campoLista( "ref_cod_cliente_tipo", "Tipo do Cliente", $opcoes_cli_tpo, $this->ref_cod_cliente_tipo, null, null, null, null, $cliente_tipo_desabilitado, $cliente_tipo_obrigatorio );
525   - }
526   - if ( $get_funcao )
527   - {
528   - if ( class_exists( "clsPmieducarFuncao" ) )
529   - {
530   - $todas_funcao = "funcao = new Array();\n";
531   - $obj_funcao = new clsPmieducarFuncao();
532   - $obj_funcao->setOrderby("nm_funcao ASC");
533   - $lst_funcao = $obj_funcao->lista( null, null, null, null, null, null, null, null, null, null, 1 );
534   - if ( is_array( $lst_funcao ) && count( $lst_funcao ) )
535   - {
536   - foreach ( $lst_funcao as $funcao )
537   - {
538   - $todas_funcao .= "funcao[funcao.length] = new Array( {$funcao["cod_funcao"]}, '{$funcao['nm_funcao']}', '{$funcao['ref_cod_instituicao']}' );\n";
539   - }
540   - }
541   - echo "<script>{$todas_funcao}</script>";
542   - }
543   - else
544   - {
545   - echo "<!--\nErro\nClasse clsPmieducarFuncao n&atilde;o encontrada\n-->";
546   - $opcoes_funcao = array( "" => "Erro na gera&ccedil;&atilde;o" );
547   - }
548   - $opcoes_funcao = array( "" => "Selecione" );
549   - if ( $this->ref_cod_instituicao )
550   - {
551   - if ( class_exists( "clsPmieducarFuncao" ) )
552   - {
553   - $obj_funcao = new clsPmieducarFuncao();
554   - $obj_funcao->setOrderby("nm_funcao ASC");
555   - $lst_funcao = $obj_funcao->lista( null, null, null, null, null, null, null, null, null, null, 1, $this->ref_cod_instituicao );
556   - if ( is_array( $lst_funcao ) && count( $lst_funcao ) )
557   - {
558   - foreach ( $lst_funcao as $funcao )
559   - {
560   - $opcoes_funcao["{$funcao['cod_funcao']}"] = "{$funcao['nm_funcao']}";
561   - }
562   - }
563   - }
564   - else
565   - {
566   - echo "<!--\nErro\nClasse clsPmieducarFuncao n&atilde;o encontrada\n-->";
567   - $opcoes_funcao = array( "" => "Erro na gera&ccedil;&atilde;o" );
568   - }
569   - }
570   - $this->campoLista( "ref_cod_funcao", "Função", $opcoes_funcao, $this->ref_cod_funcao, null, null, null, null, $funcao_desabilitado, $funcao_obrigatorio );
571   - }
572   -
573   - if ( $get_turma )
574   - {
575   - $opcoes_turma = array( "" => "Selecione" );
576   - if ( class_exists( "clsPmieducarTurma" ) )
577   - {
578   - $todas_turma = "turma = new Array();\n";
579   - $obj_turma = new clsPmieducarTurma();
580   - $obj_turma->setOrderby("nm_turma ASC");
581   - $lst_turma = $obj_turma->lista( null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1 );
582   - if ( is_array( $lst_turma ) && count( $lst_turma ) )
583   - {
584   - foreach ( $lst_turma as $turma )
585   - {
586   - $todas_turma .= "turma[turma.length] = new Array( {$turma["cod_turma"]}, '{$turma['nm_turma']}', '{$turma['ref_ref_cod_serie']}', '{$turma["ref_ref_cod_escola"]}', '{$turma["ref_cod_curso"]}' );\n";
587   - }
588   - }
589   - echo "<script>{$todas_turma}</script>";
590   -
591   - // EDITAR
592   - if ( ($this->ref_ref_cod_serie && $this->ref_cod_escola) || $this->ref_cod_curso )
593   - {
594   - $obj_turma = new clsPmieducarTurma();
595   - $obj_turma->setOrderby("nm_turma ASC");
596   - $lst_turma = $obj_turma->lista( null, null, null, $this->ref_ref_cod_serie, $this->ref_cod_escola, null, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, $this->ref_cod_curso );
597   - if ( is_array( $lst_turma ) && count( $lst_turma ) )
598   - {
599   - foreach ( $lst_turma as $turma )
600   - {
601   - $opcoes_turma["{$turma['cod_turma']}"] = "{$turma['nm_turma']}";
602   - }
603   - }
604   - }
605   - }
606   - else
607   - {
608   - echo "<!--\nErro\nClasse clsPmieducarTurma n&atilde;o encontrada\n-->";
609   - $opcoes_turma = array( "" => "Erro na gera&ccedil;&atilde;o" );
610   - }
611   - $this->campoLista( "ref_cod_turma", "Turma", $opcoes_turma, $this->ref_cod_turma, null, null, null, null, $turma_desabilitado, $turma_obrigatorio );
612   - }
613   - if (isset($get_cabecalho))
614   - {
615   - if ( $qtd_bibliotecas > 1 && ($nivel_usuario == 4 || $nivel_usuario == 8) )
616   - ${$get_cabecalho}[] = "Biblioteca";
617   - else if ($nivel_usuario == 1 || $nivel_usuario == 2 || $nivel_usuario == 4)
618   - ${$get_cabecalho}[] = "Biblioteca";
619   - if ($nivel_usuario == 1 || $nivel_usuario == 2)
620   - ${$get_cabecalho}[] = "Escola";
621   - if ($nivel_usuario == 1)
622   - ${$get_cabecalho}[] = "Institui&ccedil;&atilde;o";
623   - }
624   -?>
625   -<script>
626   -<?
627   -if ( $nivel_usuario == 1 || $nivel_usuario == 2 || $cad_usuario )
628   -{
629   -?>
630   -//caso seja preciso executar uma funcao no onchange da instituicao adicionar uma funcao as seguintes variaveis no arquivo
631   -//que precisar , assim, toda vez que for chamada a funcao serao executadas estas funcoes
632   - var before_getEscola = function(){}
633   - var after_getEscola = function(){}
634   -
635   - function getEscola()
636   - {
637   - before_getEscola();
638   -
639   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
640   - if ( document.getElementById('ref_cod_escola') )
641   - {
642   - var campoEscola = document.getElementById('ref_cod_escola');
643   - }
644   - if ( document.getElementById('ref_ref_cod_escola') )
645   - {
646   - //document.getElementById('ref_ref_cod_escola').disabled = false;
647   - var campoEscola = document.getElementById('ref_ref_cod_escola');
648   - }
649   -
650   - campoEscola.length = 1;
651   - campoEscola.options[0].text = 'Selecione uma escola';
652   -// campoEscola.disabled = false;
653   - for (var j = 0; j < escola.length; j++)
654   - {
655   - if (escola[j][2] == campoInstituicao)
656   - {
657   - campoEscola.options[campoEscola.options.length] = new Option( escola[j][1], escola[j][0],false,false);
658   - }
659   - }
660   - if ( campoEscola.length == 1 && campoInstituicao != '' ) {
661   - campoEscola.options[0] = new Option( 'A instituição não possui nenhuma escola', '', false, false );
662   - }
663   -
664   - after_getEscola();
665   - }
666   -<?
667   - if ($get_escola && $get_biblioteca)
668   - {
669   -?>
670   - function getDuploEscolaBiblioteca()
671   - {
672   - getEscola();
673   - getBiblioteca(1);
674   - }
675   -<?
676   - }
677   -}
678   -if ( $get_curso && $sem_padrao && !$get_matricula )
679   -{
680   -?>
681   - var before_getCurso = function(){}
682   - var after_getCurso = function(){}
683   -
684   - function getCurso()
685   - {
686   - before_getCurso();
687   -
688   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
689   - var campoCurso = document.getElementById('ref_cod_curso');
690   - campoCurso.length = 1;
691   -
692   - campoCurso.options[0].text = 'Selecione um curso';
693   - //campoCurso.disabled = false;
694   - for (var j = 0; j < curso.length; j++)
695   - {
696   - if ( (curso[j][3] == campoInstituicao) && (curso[j][4] == 0) )
697   - {
698   - campoCurso.options[campoCurso.options.length] = new Option( curso[j][1], curso[j][0],false,false);
699   - }
700   - }
701   - if ( campoCurso.length == 1 && campoInstituicao != '' )
702   - {
703   - campoCurso.options[0] = new Option( 'A instituição não possui nenhum curso', '', false, false );
704   - }
705   - after_getCurso();
706   - }
707   -<?
708   -}
709   -elseif ( $get_curso && !$get_matricula )
710   -{
711   -?>
712   - var before_getCurso = function(){}
713   - var after_getCurso = function(){}
714   -
715   - function getCurso()
716   - {
717   - before_getCurso();
718   -
719   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
720   - var campoCurso = document.getElementById('ref_cod_curso');
721   -
722   - campoCurso.length = 1;
723   - campoCurso.options[0].text = 'Selecione um curso';
724   - for (var j = 0; j < curso.length; j++)
725   - {
726   - if (curso[j][3] == campoInstituicao)
727   - {
728   - campoCurso.options[campoCurso.options.length] = new Option( curso[j][1], curso[j][0],false,false);
729   - }
730   - }
731   - if ( campoCurso.length == 1 && campoInstituicao != '' ) {
732   - campoCurso.options[0] = new Option( 'A instituição não possui nenhum curso', '', false, false );
733   - }
734   - after_getCurso();
735   - }
736   -<?
737   -}
738   -if ( $get_escola && $get_curso)
739   -{
740   -?>
741   - function getDuploEscolaCurso()
742   - {
743   - getEscola();
744   - getCurso();
745   - }
746   -<?
747   -}
748   -if ( $get_escola_curso )
749   -{
750   -?>
751   - var before_getEscolaCurso = function(){}
752   - var after_getEscolaCurso = function(){}
753   -
754   - function getEscolaCurso()
755   - {
756   - before_getEscolaCurso();
757   -
758   - if ( document.getElementById('ref_cod_escola') )
759   - {
760   - var campoEscola = document.getElementById('ref_cod_escola').value;
761   - }
762   - else if ( document.getElementById('ref_ref_cod_escola') )
763   - {
764   - var campoEscola = document.getElementById('ref_ref_cod_escola').value;
765   - }
766   - var campoCurso = document.getElementById('ref_cod_curso');
767   -
768   - campoCurso.length = 1;
769   - campoCurso.options[0] = new Option( 'Selecione um curso', '', false, false );
770   - for (var j = 0; j < escola_curso.length; j++)
771   - {
772   - if (escola_curso[j][2] == campoEscola)
773   - {
774   - campoCurso.options[campoCurso.options.length] = new Option( escola_curso[j][1], escola_curso[j][0],false,false);
775   - }
776   - }
777   - if ( campoCurso.length == 1 && campoEscola != '' ) {
778   - campoCurso.options[0] = new Option( 'A escola não possui nenhum curso', '', false, false );
779   - }
780   -
781   - after_getEscolaCurso();
782   - }
783   -<?
784   -}
785   -if ( $get_escola_curso_serie && $get_matricula )
786   -{
787   -?>
788   - var before_getEscolaCursoSerie= function(){}
789   - var after_getEscolaCursoSerie = function(){}
790   -
791   - function getEscolaCursoSerie()
792   - {
793   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
794   - var campoEscola = document.getElementById('ref_cod_escola').value;
795   - var campoCurso = document.getElementById('ref_cod_curso').value;
796   - var campoSerie = document.getElementById('ref_ref_cod_serie');
797   -
798   - before_getEscolaCursoSerie();
799   -
800   - campoSerie.length = 1;
801   - campoSerie.options[0] = new Option( 'Selecione uma série', '', false, false );
802   - if ( matriculas.length )
803   - {
804   - var instituicao_igual = false;
805   - for (var j = 0; j < matriculas.length; j++)
806   - {
807   - if ( matriculas[j][13] == campoInstituicao )
808   - {
809   - instituicao_igual = true;
810   - // caso a (matricula_escola seja == a escola_escolhida) e ( (matricula_escola siga o padrao_escola) e (escola_ano_letivo > ano_matricula) ou (matricula_escola NAO siga o padrao_escola) )
811   - if ( (matriculas[j][1] == campoEscola) && ( ( ( (matriculas[j][11] == 1) && (matriculas[j][10] > matriculas[j][9]) ) ) || (matriculas[j][11] != 1) ) )
812   - {
813   - // caso curso_escolhido == curso_matricula
814   - if (matriculas[j][2] == campoCurso)
815   - {
816   - // foi reprovado na serie
817   - if (matriculas[j][5] == 2)
818   - {
819   - // exibe a mesma serie
820   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][4], matriculas[j][3],false,false);
821   - }
822   - // foi aprovado na serie
823   - else if (matriculas[j][5] == 1)
824   - {
825   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
826   - {
827   - if(matriculas[j][6][ct] == campoCurso)
828   - {
829   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
830   - }
831   - }
832   - }
833   - } // caso curso_escolhido seja !
834   - else
835   - {
836   - // foi aprovado na serie
837   - if (matriculas[j][5] == 1)
838   - {
839   - // exibe somente a serie da sequencia do curso_escolhido
840   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
841   - {
842   - if (matriculas[j][6][ct] == campoCurso)
843   - {
844   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
845   - }
846   - }
847   - }
848   - // foi aprovado, reprovado ou esta em andamento na serie
849   - if ( (matriculas[j][5] == 1) || (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
850   - {
851   -// alert('aprovado == 1 || 2 || 3');
852   - var pertence_sequencia = false;
853   - var achou_serie_mat = false;
854   - var aux_serie;
855   - var ini_serie;
856   -
857   - for (var i = 0; i < ini_sequencia.length; i++)
858   - {
859   - ini_serie = ini_sequencia[i][0];
860   - var s = 0;
861   -
862   - while ( s < sequencia.length )
863   - {
864   - aux_serie = sequencia[s][1];
865   -
866   - if (ini_serie == aux_serie)
867   - {
868   - if (matriculas[j][3] == aux_serie)
869   - {
870   -// alert('achou serie matricula');
871   - achou_serie_mat = true;
872   - }
873   - if (sequencia[s][0] == campoCurso)
874   - {
875   -// alert('pertence sequencia ');
876   - pertence_sequencia = true;
877   - }
878   - else if (sequencia[s][2] == campoCurso)
879   - {
880   -// alert('pertence sequencia ');
881   - pertence_sequencia = true;
882   - }
883   - else
884   - {
885   - ini_serie = sequencia[s][3];
886   - s = -1;
887   - }
888   - }
889   - s++;
890   - }
891   - if (achou_serie_mat && pertence_sequencia)
892   - {
893   - break;
894   - }
895   - }
896   - if (achou_serie_mat && !pertence_sequencia)
897   - {
898   -// alert('nao pertence sequencia ');
899   - for (var i = 0; i < serie.length; i++)
900   - {
901   - if ( (serie[i][2] == campoEscola) && (serie[i][3] == campoCurso) )
902   - {
903   - campoSerie.options[campoSerie.options.length] = new Option( serie[i][1], serie[i][0],false,false);
904   - }
905   - }
906   -// if ( campoSerie.options.length == 1 )
907   -// {
908   -// campoSerie.options[0] = new Option( 'Nenhuma série disponível', '', false, false );
909   -// }
910   - }
911   - }
912   - }
913   - }
914   - // caso a (escola_matricula seja ! da escola_escolhida) e (exista uma solicitacao_transferencia)
915   - else if ( (matriculas[j][1] != campoEscola) && (matriculas[j][12] == 1) )
916   - {
917   -// alert('escola !');
918   - // caso curso_escolhido == curso_matricula
919   - if (matriculas[j][2] == campoCurso)
920   - {
921   - // foi (reprovado na serie) ou (esta em andamento)
922   - if ( (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
923   - {
924   - // exibe a mesma serie
925   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][4], matriculas[j][3],false,false);
926   - }
927   - // foi aprovado na serie
928   - else if (matriculas[j][5] == 1)
929   - {
930   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
931   - {
932   - // alert(matriculas[j][6]);
933   - if(matriculas[j][6][ct] == campoCurso)
934   - {
935   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
936   - }
937   - }
938   - }
939   - }// caso curso_escolhido seja !
940   - else
941   - {
942   - // foi aprovado na serie
943   - if (matriculas[j][5] == 1)
944   - {
945   - // exibe somente a serie da sequencia do curso_escolhido
946   - for (var ct = 0; ct < matriculas[j][6].length; ct++)
947   - {
948   - if (matriculas[j][6][ct] == campoCurso)
949   - {
950   - campoSerie.options[campoSerie.options.length] = new Option( matriculas[j][8][ct], matriculas[j][7][ct],false,false);
951   - }
952   - }
953   - }
954   - // foi aprovado, reprovado ou esta em andamento na serie
955   - if ( (matriculas[j][5] == 1) || (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
956   - {
957   -// alert('aprovado == 1 || 2 || 3');
958   - var pertence_sequencia = false;
959   - var achou_serie_mat = false;
960   - var aux_serie;
961   - var ini_serie;
962   -
963   - for (var i = 0; i < ini_sequencia.length; i++)
964   - {
965   - ini_serie = ini_sequencia[i][0];
966   - var s = 0;
967   -
968   - while ( s < sequencia.length )
969   - {
970   - aux_serie = sequencia[s][1];
971   -
972   - if (ini_serie == aux_serie)
973   - {
974   - if (matriculas[j][3] == aux_serie)
975   - {
976   -// alert('achou serie matricula');
977   - achou_serie_mat = true;
978   - }
979   - if (sequencia[s][0] == campoCurso)
980   - {
981   -// alert('pertence sequencia ');
982   - pertence_sequencia = true;
983   - }
984   - else if (sequencia[s][2] == campoCurso)
985   - {
986   -// alert('pertence sequencia ');
987   - pertence_sequencia = true;
988   - }
989   - else
990   - {
991   - ini_serie = sequencia[s][3];
992   - s = -1;
993   - }
994   - }
995   - s++;
996   - }
997   - if (achou_serie_mat && pertence_sequencia)
998   - {
999   - break;
1000   - }
1001   - }
1002   - if (achou_serie_mat && !pertence_sequencia)
1003   - {
1004   -// alert('nao pertence sequencia ');
1005   - for (var i = 0; i < serie.length; i++)
1006   - {
1007   - if ( (serie[i][2] == campoEscola) && (serie[i][3] == campoCurso) )
1008   - {
1009   - campoSerie.options[campoSerie.options.length] = new Option( serie[i][1], serie[i][0],false,false);
1010   - }
1011   - }
1012   - }
1013   - }
1014   - }
1015   - }
1016   - // independente da escola
1017   - else
1018   - {
1019   -// alert('independente da escola');
1020   - // caso curso_escolhido seja ! curso_matricula
1021   - if (matriculas[j][2] != campoCurso)
1022   - {
1023   - // foi aprovado, reprovado ou esta em andamento na serie
1024   - if ( (matriculas[j][5] == 1) || (matriculas[j][5] == 2) || (matriculas[j][5] == 3) )
1025   - {
1026   -// alert('aprovado == 1 || 2 || 3');
1027   - var pertence_sequencia = false;
1028   - var achou_serie_mat = false;
1029   - var aux_serie;
1030   - var ini_serie;
1031   -
1032   - for (var i = 0; i < ini_sequencia.length; i++)
1033   - {
1034   - ini_serie = ini_sequencia[i][0];
1035   -
1036   - var s = 0;
1037   - while ( s < sequencia.length )
1038   - {
1039   - aux_serie = sequencia[s][1];
1040   -
1041   - if (ini_serie == aux_serie)
1042   - {
1043   - if (matriculas[j][3] == aux_serie)
1044   - {
1045   -// alert('achou serie matricula');
1046   - achou_serie_mat = true;
1047   - }
1048   - if (sequencia[s][0] == campoCurso)
1049   - {
1050   -// alert('pertence sequencia ');
1051   - pertence_sequencia = true;
1052   - }
1053   - else if (sequencia[s][2] == campoCurso)
1054   - {
1055   -// alert('pertence sequencia ');
1056   - pertence_sequencia = true;
1057   - }
1058   - else
1059   - {
1060   - ini_serie = sequencia[s][3];
1061   - s = -1;
1062   - }
1063   - }
1064   - s++;
1065   - }
1066   - if (achou_serie_mat && pertence_sequencia)
1067   - {
1068   - break;
1069   - }
1070   - }
1071   - //modificado 190906
1072   - if ((achou_serie_mat && !pertence_sequencia) || (!achou_serie_mat && !pertence_sequencia))
1073   - {
1074   -// alert('nao pertence sequencia ');
1075   - for (var i = 0; i < serie.length; i++)
1076   - {
1077   - if ( (serie[i][2] == campoEscola) && (serie[i][3] == campoCurso) )
1078   - {
1079   - campoSerie.options[campoSerie.options.length] = new Option( serie[i][1], serie[i][0],false,false);
1080   - }
1081   - }
1082   - }
1083   - }
1084   - }
1085   - }
1086   - }
1087   - }
1088   - // caso o aluno n tenha nenhuma matricula na instituicao escolhida, eh liberado para c matricular em qq serie
1089   - if ( !instituicao_igual )
1090   - {
1091   - for (var j = 0; j < serie.length; j++)
1092   - {
1093   - if ( (serie[j][2] == campoEscola) && (serie[j][3] == campoCurso) )
1094   - {
1095   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1096   - }
1097   - }
1098   - if ( campoSerie.options.length == 1 )
1099   - {
1100   - campoSerie.options[0] = new Option( 'Nenhuma série disponível', '', false, false );
1101   - }
1102   - }
1103   - }
1104   - else // caso o aluno ainda n possua nenhuma matricula, eh liberado para c matricular em qq serie
1105   - {
1106   - for (var j = 0; j < serie.length; j++)
1107   - {
1108   - if ( (serie[j][2] == campoEscola) && (serie[j][3] == campoCurso) )
1109   - {
1110   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1111   - }
1112   - }
1113   - if ( campoSerie.options.length == 1 )
1114   - {
1115   - campoSerie.options[0] = new Option( 'Nenhuma série disponível', '', false, false );
1116   - }
1117   - }
1118   -
1119   - after_getEscolaCursoSerie();
1120   - }
1121   -<?
1122   -}
1123   -if ( $get_escola_curso_serie && !$get_matricula )
1124   -{
1125   -?>
1126   - var before_getEscolaCursoSerie= function(){}
1127   - var after_getEscolaCursoSerie = function(){}
1128   -
1129   - function getEscolaCursoSerie()
1130   - {
1131   - var campoEscola = document.getElementById('ref_cod_escola').value;
1132   - var campoCurso = document.getElementById('ref_cod_curso').value;
1133   - var campoSerie = document.getElementById('ref_ref_cod_serie');
1134   -
1135   - before_getEscolaCursoSerie();
1136   -
1137   - campoSerie.length = 1;
1138   - campoSerie.options[0] = new Option( 'Selecione uma série', '', false, false );
1139   - for (var j = 0; j < serie.length; j++)
1140   - {
1141   - if ((serie[j][2] == campoEscola) && (serie[j][3] == campoCurso))
1142   - {
1143   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1144   - }
1145   - }
1146   - if ( campoSerie.length == 1 && campoCurso != '' ) {
1147   - campoSerie.options[0] = new Option( 'O curso não possui nenhuma série', '', false, false );
1148   - }
1149   -
1150   - after_getEscolaCursoSerie();
1151   - }
1152   -<?
1153   -}
1154   -if ( $get_serie && $get_escola_serie )
1155   -{
1156   -?>
1157   -
1158   - var before_getSerie= function(){}
1159   - var after_getSerie = function(){}
1160   -
1161   - function getSerie()
1162   - {
1163   - var campoEscola = document.getElementById('ref_cod_escola').value;
1164   - var campoCurso = document.getElementById('ref_cod_curso').value;
1165   - var campoSerie = document.getElementById('ref_cod_serie');
1166   -
1167   - before_getSerie();
1168   -
1169   - campoSerie.length = 1;
1170   - for (var j = 0; j < serie.length; j++)
1171   - {
1172   - if (serie[j][2] == campoCurso)
1173   - {
1174   - var achou = false;
1175   - for(var ct = 0;ct < serie[j][3].length;ct++)
1176   - {
1177   - if(serie[j][3][ct] == campoEscola){
1178   - achou = true;
1179   - break;
1180   - }
1181   - }
1182   -
1183   - if(!achou)
1184   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1185   - }
1186   - }
1187   -
1188   - after_getSerie();
1189   - }
1190   -<?
1191   -}
1192   -if ( $get_serie && !$get_escola_serie )
1193   -{
1194   -?>
1195   - function getSerie()
1196   - {
1197   - var campoCurso = document.getElementById('ref_cod_curso').value;
1198   - var campoSerie = document.getElementById('ref_cod_serie');
1199   -
1200   - campoSerie.length = 1;
1201   - for (var j = 0; j < serie.length; j++)
1202   - {
1203   - if (serie[j][2] == campoCurso)
1204   - {
1205   - campoSerie.options[campoSerie.options.length] = new Option( serie[j][1], serie[j][0],false,false);
1206   - }
1207   - }
1208   - }
1209   -<?
1210   -}
1211   -if ( $get_biblioteca )
1212   -{
1213   -?>
1214   - var before_getBiblioteca = function(){}
1215   - var after_getBiblioteca = function(){}
1216   -
1217   - function getBiblioteca(flag)
1218   - {
1219   - before_getBiblioteca();
1220   -
1221   - var campoBiblioteca = document.getElementById('ref_cod_biblioteca');
1222   -
1223   - campoBiblioteca.length = 1;
1224   - campoBiblioteca.options[0].text = 'Selecione uma biblioteca';
1225   - if (flag == 1)
1226   - {
1227   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
1228   - for (var j = 0; j < biblioteca.length; j++)
1229   - {
1230   - if (biblioteca[j][3] == campoInstituicao)
1231   - {
1232   - campoBiblioteca.options[campoBiblioteca.options.length] = new Option( biblioteca[j][1], biblioteca[j][0],false,false);
1233   - }
1234   - }
1235   - if ( campoBiblioteca.length == 1 && campoInstituicao != '' )
1236   - campoBiblioteca.options[0] = new Option( 'A instituição não possui nenhuma biblioteca', '', false, false );
1237   - }
1238   - else if (flag == 2)
1239   - {
1240   - var campoEscola = document.getElementById('ref_cod_escola').value;
1241   - for (var j = 0; j < biblioteca.length; j++)
1242   - {
1243   - if (biblioteca[j][2] == campoEscola)
1244   - {
1245   - campoBiblioteca.options[campoBiblioteca.options.length] = new Option( biblioteca[j][1], biblioteca[j][0],false,false);
1246   - }
1247   - }
1248   - if ( campoBiblioteca.length == 1 && campoEscola != '' )
1249   - campoBiblioteca.options[0] = new Option( 'A escola não possui nenhuma biblioteca', '', false, false );
1250   - }
1251   -
1252   - after_getBiblioteca();
1253   - }
1254   -<?
1255   -}
1256   -if ( $get_cliente_tipo )
1257   -{
1258   -?>
1259   - var before_getClienteTipo = function(){}
1260   - var after_getClienteTipo = function(){}
1261   -
1262   - function getClienteTipo()
1263   - {
1264   - before_getClienteTipo();
1265   -
1266   - var campoBiblioteca = document.getElementById( 'ref_cod_biblioteca' ).value;
1267   - var campoClienteTipo = document.getElementById( 'ref_cod_cliente_tipo' );
1268   -
1269   - campoClienteTipo.length = 1;
1270   - campoClienteTipo.options[0] = new Option( 'Selecione um tipo de cliente', '', false, false );
1271   - for (var j = 0; j < cliente_tipo.length; j++)
1272   - {
1273   - if ( ( cliente_tipo[j][2] == campoBiblioteca ) )
1274   - {
1275   - campoClienteTipo.options[campoClienteTipo.options.length] = new Option( cliente_tipo[j][1], cliente_tipo[j][0], false, false );
1276   - }
1277   - }
1278   - if ( campoClienteTipo.length == 1 && campoBiblioteca != '' ) {
1279   - campoClienteTipo.options[0] = new Option( 'A biblioteca não possui nenhum tipo de cliente', '', false, false );
1280   - }
1281   -
1282   - after_getClienteTipo();
1283   - }
1284   -<?
1285   -}
1286   -if ( $get_funcao )
1287   -{
1288   -?>
1289   - var before_getFuncao = function(){}
1290   - var after_getFuncao = function(){}
1291   -
1292   - function getFuncao()
1293   - {
1294   - before_getFuncao();
1295   -
1296   - var campoInstituicao = document.getElementById( 'ref_cod_instituicao' ).value;
1297   - var campoFuncao = document.getElementById( 'ref_cod_funcao' );
1298   -
1299   - campoFuncao.length = 1;
1300   - campoFuncao.options[0] = new Option( 'Selecione uma Função', '', false, false );
1301   - for (var j = 0; j < funcao.length; j++)
1302   - {
1303   - if ( ( funcao[j][2] == campoInstituicao ) )
1304   - {
1305   - campoFuncao.options[campoFuncao.options.length] = new Option( funcao[j][1], funcao[j][0], false, false );
1306   - }
1307   - }
1308   - if ( campoFuncao.length == 1 && campoInstituicao != '' ) {
1309   - campoFuncao.options[0] = new Option( 'A instituição não possui nenhuma função', '', false, false );
1310   - }
1311   -
1312   - after_getFuncao();
1313   - }
1314   -<?
1315   -}
1316   -if ( $get_turma )
1317   -{
1318   -?>
1319   - var before_getTurma = function(){}
1320   - var after_getTurma = function(){}
1321   -
1322   - function getTurma()
1323   - {
1324   - before_getTurma();
1325   -
1326   - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;
1327   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
1328   - var campoTurma = document.getElementById( 'ref_cod_turma' );
1329   -
1330   - campoTurma.length = 1;
1331   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
1332   - for ( var j = 0; j < turma.length; j++ )
1333   - {
1334   - if ( ( turma[j][2] == campoSerie ) && ( turma[j][3] == campoEscola ) )
1335   - {
1336   - campoTurma.options[campoTurma.options.length] = new Option( turma[j][1], turma[j][0], false, false );
1337   - }
1338   - }
1339   - if ( campoTurma.length == 1 && campoSerie != '' ) {
1340   - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false );
1341   - }
1342   -
1343   - after_getTurma();
1344   - }
1345   -<?
1346   -}
1347   -
1348   -?>
1349   -
1350   -</script>
1351 0 \ No newline at end of file
ieducar/intranet/pdf/.gitkeep
ieducar/intranet/scripts/ajax.js
... ... @@ -1,361 +0,0 @@
1   -/* Prototype JavaScript framework, version 1.4.0_pre10_ajax
2   - * (c) 2005 Sam Stephenson <sam@conio.net>
3   - *
4   - * This is a downcut version for AJAX by Alexander Kirk http://alexander.kirk.at/
5   - *
6   - * Prototype is freely distributable under the terms of an MIT-style license.
7   - *
8   - * For details, see the Prototype web site: http://prototype.conio.net/
9   - *
10   -/*--------------------------------------------------------------------------*/
11   -
12   -var Prototype = {
13   - Version: '1.4.0_pre10_ajax',
14   -
15   - emptyFunction: function() {},
16   - K: function(x) {return x}
17   -}
18   -
19   -var Class = {
20   - create: function() {
21   - return function() {
22   - this.initialize.apply(this, arguments);
23   - }
24   - }
25   -}
26   -
27   -var Abstract = new Object();
28   -
29   -Object.extend = function(destination, source) {
30   - for (property in source) {
31   - destination[property] = source[property];
32   - }
33   - return destination;
34   -}
35   -
36   -Object.inspect = function(object) {
37   - try {
38   - if (object == undefined) return 'undefined';
39   - if (object == null) return 'null';
40   - return object.inspect ? object.inspect() : object.toString();
41   - } catch (e) {
42   - if (e instanceof RangeError) return '...';
43   - throw e;
44   - }
45   -}
46   -
47   -Function.prototype.bind = function(object) {
48   - var __method = this;
49   - return function() {
50   - return __method.apply(object, arguments);
51   - }
52   -}
53   -
54   -Function.prototype.bindAsEventListener = function(object) {
55   - var __method = this;
56   - return function(event) {
57   - return __method.call(object, event || window.event);
58   - }
59   -}
60   -
61   -Object.extend(Number.prototype, {
62   - toColorPart: function() {
63   - var digits = this.toString(16);
64   - if (this < 16) return '0' + digits;
65   - return digits;
66   - },
67   -
68   - succ: function() {
69   - return this + 1;
70   - },
71   -
72   - times: function(iterator) {
73   - $R(0, this, true).each(iterator);
74   - return this;
75   - }
76   -});
77   -
78   -var Try = {
79   - these: function() {
80   - var returnValue;
81   -
82   - for (var i = 0; i < arguments.length; i++) {
83   - var lambda = arguments[i];
84   - try {
85   - returnValue = lambda();
86   - break;
87   - } catch (e) {}
88   - }
89   -
90   - return returnValue;
91   - }
92   -}
93   -
94   -/*--------------------------------------------------------------------------*/
95   -
96   -var PeriodicalExecuter = Class.create();
97   -PeriodicalExecuter.prototype = {
98   - initialize: function(callback, frequency) {
99   - this.callback = callback;
100   - this.frequency = frequency;
101   - this.currentlyExecuting = false;
102   -
103   - this.registerCallback();
104   - },
105   -
106   - registerCallback: function() {
107   - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
108   - },
109   -
110   - onTimerEvent: function() {
111   - if (!this.currentlyExecuting) {
112   - try {
113   - this.currentlyExecuting = true;
114   - this.callback();
115   - } finally {
116   - this.currentlyExecuting = false;
117   - }
118   - }
119   - }
120   -}
121   -
122   -/*--------------------------------------------------------------------------*/
123   -
124   -function $() {
125   - var elements = new Array();
126   -
127   - for (var i = 0; i < arguments.length; i++) {
128   - var element = arguments[i];
129   - if (typeof element == 'string')
130   - element = document.getElementById(element);
131   -
132   - if (arguments.length == 1)
133   - return element;
134   -
135   - elements.push(element);
136   - }
137   -
138   - return elements;
139   -}
140   -
141   -
142   -
143   -var Ajax = {
144   - getTransport: function() {
145   - return Try.these(
146   - function() {return new ActiveXObject('Msxml2.XMLHTTP')},
147   - function() {return new ActiveXObject('Microsoft.XMLHTTP')},
148   - function() {return new XMLHttpRequest()}
149   - ) || false;
150   - }
151   -}
152   -
153   -Ajax.Base = function() {};
154   -Ajax.Base.prototype = {
155   - setOptions: function(options) {
156   - this.options = {
157   - method: 'post',
158   - asynchronous: true,
159   - parameters: ''
160   - }
161   - Object.extend(this.options, options || {});
162   - },
163   -
164   - responseIsSuccess: function() {
165   - return this.transport.status == undefined
166   - || this.transport.status == 0
167   - || (this.transport.status >= 200 && this.transport.status < 300);
168   - },
169   -
170   - responseIsFailure: function() {
171   - return !this.responseIsSuccess();
172   - }
173   -}
174   -
175   -Ajax.Request = Class.create();
176   -Ajax.Request.Events =
177   - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
178   -
179   -Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
180   - initialize: function(url, options) {
181   - this.transport = Ajax.getTransport();
182   - this.setOptions(options);
183   - this.request(url);
184   - },
185   -
186   - request: function(url) {
187   - var parameters = this.options.parameters || '';
188   - if (parameters.length > 0) parameters += '&_=';
189   -
190   - try {
191   - if (this.options.method == 'get')
192   - url += '?' + parameters;
193   - this.transport.open(this.options.method, url,
194   - this.options.asynchronous);
195   -
196   - if (this.options.asynchronous) {
197   - this.transport.onreadystatechange = this.onStateChange.bind(this);
198   - setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
199   - }
200   -
201   - this.setRequestHeaders();
202   -
203   - var body = this.options.postBody ? this.options.postBody : parameters;
204   - this.transport.send(this.options.method == 'post' ? body : null);
205   -
206   - } catch (e) {
207   - }
208   - },
209   -
210   - setRequestHeaders: function() {
211   - var requestHeaders =
212   - ['X-Requested-With', 'XMLHttpRequest',
213   - 'X-Prototype-Version', Prototype.Version];
214   -
215   - if (this.options.method == 'post') {
216   - requestHeaders.push('Content-type',
217   - 'application/x-www-form-urlencoded');
218   -
219   - /* Force "Connection: close" for Mozilla browsers to work around
220   - * a bug where XMLHttpReqeuest sends an incorrect Content-length
221   - * header. See Mozilla Bugzilla #246651.
222   - */
223   - if (this.transport.overrideMimeType)
224   - requestHeaders.push('Connection', 'close');
225   - }
226   -
227   - if (this.options.requestHeaders)
228   - requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
229   -
230   - for (var i = 0; i < requestHeaders.length; i += 2)
231   - this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
232   - },
233   -
234   - onStateChange: function() {
235   - var readyState = this.transport.readyState;
236   - if (readyState != 1)
237   - this.respondToReadyState(this.transport.readyState);
238   - },
239   -
240   - evalJSON: function() {
241   - try {
242   - var json = this.transport.getResponseHeader('X-JSON'), object;
243   - object = eval(json);
244   - return object;
245   - } catch (e) {
246   - }
247   - },
248   -
249   - respondToReadyState: function(readyState) {
250   - var event = Ajax.Request.Events[readyState];
251   - var transport = this.transport, json = this.evalJSON();
252   -
253   - if (event == 'Complete')
254   - (this.options['on' + this.transport.status]
255   - || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
256   - || Prototype.emptyFunction)(transport, json);
257   -
258   - (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
259   -
260   - /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
261   - if (event == 'Complete')
262   - this.transport.onreadystatechange = Prototype.emptyFunction;
263   - }
264   -});
265   -
266   -Ajax.Updater = Class.create();
267   -Ajax.Updater.ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:<\/script>)';
268   -
269   -Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
270   - initialize: function(container, url, options) {
271   - this.containers = {
272   - success: container.success ? $(container.success) : $(container),
273   - failure: container.failure ? $(container.failure) :
274   - (container.success ? null : $(container))
275   - }
276   -
277   - this.transport = Ajax.getTransport();
278   - this.setOptions(options);
279   -
280   - var onComplete = this.options.onComplete || Prototype.emptyFunction;
281   - this.options.onComplete = (function(transport, object) {
282   - this.updateContent();
283   - onComplete(transport, object);
284   - }).bind(this);
285   -
286   - this.request(url);
287   - },
288   -
289   - updateContent: function() {
290   - var receiver = this.responseIsSuccess() ?
291   - this.containers.success : this.containers.failure;
292   -
293   - var match = new RegExp(Ajax.Updater.ScriptFragment, 'img');
294   - var response = this.transport.responseText.replace(match, '');
295   - var scripts = this.transport.responseText.match(match);
296   -
297   - if (receiver) {
298   - if (this.options.insertion) {
299   - new this.options.insertion(receiver, response);
300   - } else {
301   - receiver.innerHTML = response;
302   - }
303   - }
304   -
305   - if (this.responseIsSuccess()) {
306   - if (this.onComplete)
307   - setTimeout(this.onComplete.bind(this), 10);
308   - }
309   -
310   - if (this.options.evalScripts && scripts) {
311   - match = new RegExp(Ajax.Updater.ScriptFragment, 'im');
312   - setTimeout((function() {
313   - for (var i = 0; i < scripts.length; i++)
314   - eval(scripts[i].match(match)[1]);
315   - }).bind(this), 10);
316   - }
317   - }
318   -});
319   -
320   -Ajax.PeriodicalUpdater = Class.create();
321   -Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
322   - initialize: function(container, url, options) {
323   - this.setOptions(options);
324   - this.onComplete = this.options.onComplete;
325   -
326   - this.frequency = (this.options.frequency || 2);
327   - this.decay = 1;
328   -
329   - this.updater = {};
330   - this.container = container;
331   - this.url = url;
332   -
333   - this.start();
334   - },
335   -
336   - start: function() {
337   - this.options.onComplete = this.updateComplete.bind(this);
338   - this.onTimerEvent();
339   - },
340   -
341   - stop: function() {
342   - this.updater.onComplete = undefined;
343   - clearTimeout(this.timer);
344   - (this.onComplete || Ajax.emptyFunction).apply(this, arguments);
345   - },
346   -
347   - updateComplete: function(request) {
348   - if (this.options.decay) {
349   - this.decay = (request.responseText == this.lastText ?
350   - this.decay * this.options.decay : 1);
351   -
352   - this.lastText = request.responseText;
353   - }
354   - this.timer = setTimeout(this.onTimerEvent.bind(this),
355   - this.decay * this.frequency * 1000);
356   - },
357   -
358   - onTimerEvent: function() {
359   - this.updater = new Ajax.Updater(this.container, this.url, this.options);
360   - }
361   -});
ieducar/intranet/scripts/scriptaculous/effects.js
... ... @@ -1,1168 +0,0 @@
1   -// script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
2   -
3   -// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4   -// Contributors:
5   -// Justin Palmer (http://encytemedia.com/)
6   -// Mark Pilgrim (http://diveintomark.org/)
7   -// Martin Bialasinki
8   -//
9   -// script.aculo.us is freely distributable under the terms of an MIT-style license.
10   -// For details, see the script.aculo.us web site: http://script.aculo.us/
11   -
12   -// converts rgb() and #xxx to #xxxxxx format,
13   -// returns self (or first argument) if not convertable
14   -String.prototype.parseColor = function() {
15   - var color = '#';
16   - if(this.slice(0,4) == 'rgb(') {
17   - var cols = this.slice(4,this.length-1).split(',');
18   - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
19   - } else {
20   - if(this.slice(0,1) == '#') {
21   - if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
22   - if(this.length==7) color = this.toLowerCase();
23   - }
24   - }
25   - return(color.length==7 ? color : (arguments[0] || this));
26   -}
27   -
28   -/*--------------------------------------------------------------------------*/
29   -
30   -Element.collectTextNodes = function(element) {
31   - return $A($(element).childNodes).collect( function(node) {
32   - return (node.nodeType==3 ? node.nodeValue :
33   - (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
34   - }).flatten().join('');
35   -}
36   -
37   -Element.collectTextNodesIgnoreClass = function(element, className) {
38   - return $A($(element).childNodes).collect( function(node) {
39   - return (node.nodeType==3 ? node.nodeValue :
40   - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
41   - Element.collectTextNodesIgnoreClass(node, className) : ''));
42   - }).flatten().join('');
43   -}
44   -
45   -Element.setContentZoom = function(element, percent) {
46   - element = $(element);
47   - element.setStyle({fontSize: (percent/100) + 'em'});
48   - if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
49   - return element;
50   -}
51   -
52   -Element.getOpacity = function(element){
53   - return $(element).getStyle('opacity');
54   -}
55   -
56   -Element.setOpacity = function(element, value){
57   - return $(element).setStyle({opacity:value});
58   -}
59   -
60   -Element.getInlineOpacity = function(element){
61   - return $(element).style.opacity || '';
62   -}
63   -
64   -Element.forceRerendering = function(element) {
65   - try {
66   - element = $(element);
67   - var n = document.createTextNode(' ');
68   - element.appendChild(n);
69   - element.removeChild(n);
70   - } catch(e) { }
71   -};
72   -
73   -/*--------------------------------------------------------------------------*/
74   -
75   -Array.prototype.call = function() {
76   - var args = arguments;
77   - this.each(function(f){ f.apply(this, args) });
78   -}
79   -
80   -/*--------------------------------------------------------------------------*/
81   -
82   -var Effect = {
83   - _elementDoesNotExistError: {
84   - name: 'ElementDoesNotExistError',
85   - message: 'The specified DOM element does not exist, but is required for this effect to operate'
86   - },
87   - tagifyText: function(element) {
88   - if(typeof Builder == 'undefined')
89   - throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
90   -
91   - var tagifyStyle = 'position:relative';
92   - if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1';
93   -
94   - element = $(element);
95   - $A(element.childNodes).each( function(child) {
96   - if(child.nodeType==3) {
97   - child.nodeValue.toArray().each( function(character) {
98   - element.insertBefore(
99   - Builder.node('span',{style: tagifyStyle},
100   - character == ' ' ? String.fromCharCode(160) : character),
101   - child);
102   - });
103   - Element.remove(child);
104   - }
105   - });
106   - },
107   - multiple: function(element, effect) {
108   - var elements;
109   - if(((typeof element == 'object') ||
110   - (typeof element == 'function')) &&
111   - (element.length))
112   - elements = element;
113   - else
114   - elements = $(element).childNodes;
115   -
116   - var options = Object.extend({
117   - speed: 0.1,
118   - delay: 0.0
119   - }, arguments[2] || {});
120   - var masterDelay = options.delay;
121   -
122   - $A(elements).each( function(element, index) {
123   - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
124   - });
125   - },
126   - PAIRS: {
127   - 'slide': ['SlideDown','SlideUp'],
128   - 'blind': ['BlindDown','BlindUp'],
129   - 'appear': ['Appear','Fade']
130   - },
131   - toggle: function(element, effect) {
132   - element = $(element);
133   - effect = (effect || 'appear').toLowerCase();
134   - var options = Object.extend({
135   - queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
136   - }, arguments[2] || {});
137   - Effect[element.visible() ?
138   - Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
139   - }
140   -};
141   -
142   -var Effect2 = Effect; // deprecated
143   -
144   -/* ------------- transitions ------------- */
145   -
146   -Effect.Transitions = {
147   - linear: Prototype.K,
148   - sinoidal: function(pos) {
149   - return (-Math.cos(pos*Math.PI)/2) + 0.5;
150   - },
151   - reverse: function(pos) {
152   - return 1-pos;
153   - },
154   - flicker: function(pos) {
155   - return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
156   - },
157   - wobble: function(pos) {
158   - return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
159   - },
160   - pulse: function(pos, pulses) {
161   - pulses = pulses || 5;
162   - return (
163   - Math.round((pos % (1/pulses)) * pulses) == 0 ?
164   - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
165   - 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
166   - );
167   - },
168   - none: function(pos) {
169   - return 0;
170   - },
171   - full: function(pos) {
172   - return 1;
173   - }
174   -};
175   -
176   -/* ------------- core effects ------------- */
177   -
178   -Effect.ScopedQueue = Class.create();
179   -Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
180   - initialize: function() {
181   - this.effects = [];
182   - this.interval = null;
183   - },
184   - _each: function(iterator) {
185   - this.effects._each(iterator);
186   - },
187   - add: function(effect) {
188   - var timestamp = new Date().getTime();
189   -
190   - var position = (typeof effect.options.queue == 'string') ?
191   - effect.options.queue : effect.options.queue.position;
192   -
193   - switch(position) {
194   - case 'front':
195   - // move unstarted effects after this effect
196   - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
197   - e.startOn += effect.finishOn;
198   - e.finishOn += effect.finishOn;
199   - });
200   - break;
201   - case 'with-last':
202   - timestamp = this.effects.pluck('startOn').max() || timestamp;
203   - break;
204   - case 'end':
205   - // start effect after last queued effect has finished
206   - timestamp = this.effects.pluck('finishOn').max() || timestamp;
207   - break;
208   - }
209   -
210   - effect.startOn += timestamp;
211   - effect.finishOn += timestamp;
212   -
213   - if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
214   - this.effects.push(effect);
215   -
216   - if(!this.interval)
217   - this.interval = setInterval(this.loop.bind(this), 15);
218   - },
219   - remove: function(effect) {
220   - this.effects = this.effects.reject(function(e) { return e==effect });
221   - if(this.effects.length == 0) {
222   - clearInterval(this.interval);
223   - this.interval = null;
224   - }
225   - },
226   - loop: function() {
227   - var timePos = new Date().getTime();
228   - for(var i=0, len=this.effects.length;i<len;i++)
229   - if(this.effects[i]) this.effects[i].loop(timePos);
230   - }
231   -});
232   -
233   -Effect.Queues = {
234   - instances: $H(),
235   - get: function(queueName) {
236   - if(typeof queueName != 'string') return queueName;
237   -
238   - if(!this.instances[queueName])
239   - this.instances[queueName] = new Effect.ScopedQueue();
240   -
241   - return this.instances[queueName];
242   - }
243   -}
244   -Effect.Queue = Effect.Queues.get('global');
245   -
246   -Effect.DefaultOptions = {
247   - transition: Effect.Transitions.sinoidal,
248   - duration: 1.0, // seconds
249   - fps: 60.0, // max. 60fps due to Effect.Queue implementation
250   - sync: false, // true for combining
251   - from: 0.0,
252   - to: 1.0,
253   - delay: 0.0,
254   - queue: 'parallel'
255   -}
256   -
257   -Effect.Base = function() {};
258   -Effect.Base.prototype = {
259   - position: null,
260   - start: function(options) {
261   - this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
262   - this.currentFrame = 0;
263   - this.state = 'idle';
264   - this.startOn = this.options.delay*1000;
265   - this.finishOn = this.startOn + (this.options.duration*1000);
266   - this.event('beforeStart');
267   - if(!this.options.sync)
268   - Effect.Queues.get(typeof this.options.queue == 'string' ?
269   - 'global' : this.options.queue.scope).add(this);
270   - },
271   - loop: function(timePos) {
272   - if(timePos >= this.startOn) {
273   - if(timePos >= this.finishOn) {
274   - this.render(1.0);
275   - this.cancel();
276   - this.event('beforeFinish');
277   - if(this.finish) this.finish();
278   - this.event('afterFinish');
279   - return;
280   - }
281   - var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
282   - var frame = Math.round(pos * this.options.fps * this.options.duration);
283   - if(frame > this.currentFrame) {
284   - this.render(pos);
285   - this.currentFrame = frame;
286   - }
287   - }
288   - },
289   - render: function(pos) {
290   - if(this.state == 'idle') {
291   - this.state = 'running';
292   - this.event('beforeSetup');
293   - if(this.setup) this.setup();
294   - this.event('afterSetup');
295   - }
296   - if(this.state == 'running') {
297   - if(this.options.transition) pos = this.options.transition(pos);
298   - pos *= (this.options.to-this.options.from);
299   - pos += this.options.from;
300   - this.position = pos;
301   - this.event('beforeUpdate');
302   - if(this.update) this.update(pos);
303   - this.event('afterUpdate');
304   - }
305   - },
306   - cancel: function() {
307   - if(!this.options.sync)
308   - Effect.Queues.get(typeof this.options.queue == 'string' ?
309   - 'global' : this.options.queue.scope).remove(this);
310   - this.state = 'finished';
311   - },
312   - event: function(eventName) {
313   - if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
314   - if(this.options[eventName]) this.options[eventName](this);
315   - },
316   - inspect: function() {
317   - var data = $H();
318   - for(property in this)
319   - if(typeof this[property] != 'function') data[property] = this[property];
320   - return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
321   - }
322   -}
323   -
324   -Effect.Parallel = Class.create();
325   -Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
326   - initialize: function(effects) {
327   - this.effects = effects || [];
328   - this.start(arguments[1]);
329   - },
330   - update: function(position) {
331   - this.effects.invoke('render', position);
332   - },
333   - finish: function(position) {
334   - this.effects.each( function(effect) {
335   - effect.render(1.0);
336   - effect.cancel();
337   - effect.event('beforeFinish');
338   - if(effect.finish) effect.finish(position);
339   - effect.event('afterFinish');
340   - });
341   - }
342   -});
343   -
344   -Effect.Event = Class.create();
345   -Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), {
346   - initialize: function() {
347   - var options = Object.extend({
348   - duration: 0
349   - }, arguments[0] || {});
350   - this.start(options);
351   - },
352   - update: Prototype.emptyFunction
353   -});
354   -
355   -Effect.Opacity = Class.create();
356   -Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
357   - initialize: function(element) {
358   - this.element = $(element);
359   - if(!this.element) throw(Effect._elementDoesNotExistError);
360   - // make this work on IE on elements without 'layout'
361   - if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout))
362   - this.element.setStyle({zoom: 1});
363   - var options = Object.extend({
364   - from: this.element.getOpacity() || 0.0,
365   - to: 1.0
366   - }, arguments[1] || {});
367   - this.start(options);
368   - },
369   - update: function(position) {
370   - this.element.setOpacity(position);
371   - }
372   -});
373   -
374   -Effect.Move = Class.create();
375   -Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
376   - initialize: function(element) {
377   - this.element = $(element);
378   - if(!this.element) throw(Effect._elementDoesNotExistError);
379   - var options = Object.extend({
380   - x: 0,
381   - y: 0,
382   - mode: 'relative'
383   - }, arguments[1] || {});
384   - this.start(options);
385   - },
386   - setup: function() {
387   - // Bug in Opera: Opera returns the "real" position of a static element or
388   - // relative element that does not have top/left explicitly set.
389   - // ==> Always set top and left for position relative elements in your stylesheets
390   - // (to 0 if you do not need them)
391   - this.element.makePositioned();
392   - this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
393   - this.originalTop = parseFloat(this.element.getStyle('top') || '0');
394   - if(this.options.mode == 'absolute') {
395   - // absolute movement, so we need to calc deltaX and deltaY
396   - this.options.x = this.options.x - this.originalLeft;
397   - this.options.y = this.options.y - this.originalTop;
398   - }
399   - },
400   - update: function(position) {
401   - this.element.setStyle({
402   - left: Math.round(this.options.x * position + this.originalLeft) + 'px',
403   - top: Math.round(this.options.y * position + this.originalTop) + 'px'
404   - });
405   - }
406   -});
407   -
408   -// for backwards compatibility
409   -Effect.MoveBy = function(element, toTop, toLeft) {
410   - return new Effect.Move(element,
411   - Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
412   -};
413   -
414   -Effect.Scale = Class.create();
415   -Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
416   - initialize: function(element, percent) {
417   - this.element = $(element);
418   - if(!this.element) throw(Effect._elementDoesNotExistError);
419   - var options = Object.extend({
420   - scaleX: true,
421   - scaleY: true,
422   - scaleContent: true,
423   - scaleFromCenter: false,
424   - scaleMode: 'box', // 'box' or 'contents' or {} with provided values
425   - scaleFrom: 100.0,
426   - scaleTo: percent
427   - }, arguments[2] || {});
428   - this.start(options);
429   - },
430   - setup: function() {
431   - this.restoreAfterFinish = this.options.restoreAfterFinish || false;
432   - this.elementPositioning = this.element.getStyle('position');
433   -
434   - this.originalStyle = {};
435   - ['top','left','width','height','fontSize'].each( function(k) {
436   - this.originalStyle[k] = this.element.style[k];
437   - }.bind(this));
438   -
439   - this.originalTop = this.element.offsetTop;
440   - this.originalLeft = this.element.offsetLeft;
441   -
442   - var fontSize = this.element.getStyle('font-size') || '100%';
443   - ['em','px','%','pt'].each( function(fontSizeType) {
444   - if(fontSize.indexOf(fontSizeType)>0) {
445   - this.fontSize = parseFloat(fontSize);
446   - this.fontSizeType = fontSizeType;
447   - }
448   - }.bind(this));
449   -
450   - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
451   -
452   - this.dims = null;
453   - if(this.options.scaleMode=='box')
454   - this.dims = [this.element.offsetHeight, this.element.offsetWidth];
455   - if(/^content/.test(this.options.scaleMode))
456   - this.dims = [this.element.scrollHeight, this.element.scrollWidth];
457   - if(!this.dims)
458   - this.dims = [this.options.scaleMode.originalHeight,
459   - this.options.scaleMode.originalWidth];
460   - },
461   - update: function(position) {
462   - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
463   - if(this.options.scaleContent && this.fontSize)
464   - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
465   - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
466   - },
467   - finish: function(position) {
468   - if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
469   - },
470   - setDimensions: function(height, width) {
471   - var d = {};
472   - if(this.options.scaleX) d.width = Math.round(width) + 'px';
473   - if(this.options.scaleY) d.height = Math.round(height) + 'px';
474   - if(this.options.scaleFromCenter) {
475   - var topd = (height - this.dims[0])/2;
476   - var leftd = (width - this.dims[1])/2;
477   - if(this.elementPositioning == 'absolute') {
478   - if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
479   - if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
480   - } else {
481   - if(this.options.scaleY) d.top = -topd + 'px';
482   - if(this.options.scaleX) d.left = -leftd + 'px';
483   - }
484   - }
485   - this.element.setStyle(d);
486   - }
487   -});
488   -
489   -Effect.Highlight = Class.create();
490   -Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
491   - initialize: function(element) {
492   - this.element = $(element);
493   - if(!this.element) throw(Effect._elementDoesNotExistError);
494   - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
495   - this.start(options);
496   - },
497   - setup: function() {
498   - // Prevent executing on elements not in the layout flow
499   - if(this.element.getStyle('display')=='none') { this.cancel(); return; }
500   - // Disable background image during the effect
501   - this.oldStyle = {};
502   - if (!this.options.keepBackgroundImage) {
503   - this.oldStyle.backgroundImage = this.element.getStyle('background-image');
504   - this.element.setStyle({backgroundImage: 'none'});
505   - }
506   - if(!this.options.endcolor)
507   - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
508   - if(!this.options.restorecolor)
509   - this.options.restorecolor = this.element.getStyle('background-color');
510   - // init color calculations
511   - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
512   - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
513   - },
514   - update: function(position) {
515   - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
516   - return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
517   - },
518   - finish: function() {
519   - this.element.setStyle(Object.extend(this.oldStyle, {
520   - backgroundColor: this.options.restorecolor
521   - }));
522   - }
523   -});
524   -
525   -Effect.ScrollTo = Class.create();
526   -Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
527   - initialize: function(element) {
528   - this.element = $(element);
529   - this.start(arguments[1] || {});
530   - },
531   - setup: function() {
532   - Position.prepare();
533   - var offsets = Position.cumulativeOffset(this.element);
534   - if(this.options.offset) offsets[1] += this.options.offset;
535   - var max = window.innerHeight ?
536   - window.height - window.innerHeight :
537   - document.body.scrollHeight -
538   - (document.documentElement.clientHeight ?
539   - document.documentElement.clientHeight : document.body.clientHeight);
540   - this.scrollStart = Position.deltaY;
541   - this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
542   - },
543   - update: function(position) {
544   - Position.prepare();
545   - window.scrollTo(Position.deltaX,
546   - this.scrollStart + (position*this.delta));
547   - }
548   -});
549   -
550   -/* ------------- combination effects ------------- */
551   -
552   -Effect.Fade = function(element) {
553   - element = $(element);
554   - var oldOpacity = element.getInlineOpacity();
555   - var options = Object.extend({
556   - from: element.getOpacity() || 1.0,
557   - to: 0.0,
558   - afterFinishInternal: function(effect) {
559   - if(effect.options.to!=0) return;
560   - effect.element.hide().setStyle({opacity: oldOpacity});
561   - }}, arguments[1] || {});
562   - return new Effect.Opacity(element,options);
563   -}
564   -
565   -Effect.Appear = function(element) {
566   - element = $(element);
567   - var options = Object.extend({
568   - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
569   - to: 1.0,
570   - // force Safari to render floated elements properly
571   - afterFinishInternal: function(effect) {
572   - effect.element.forceRerendering();
573   - },
574   - beforeSetup: function(effect) {
575   - effect.element.setOpacity(effect.options.from).show();
576   - }}, arguments[1] || {});
577   - return new Effect.Opacity(element,options);
578   -}
579   -
580   -Effect.Puff = function(element) {
581   - element = $(element);
582   - var oldStyle = {
583   - opacity: element.getInlineOpacity(),
584   - position: element.getStyle('position'),
585   - top: element.style.top,
586   - left: element.style.left,
587   - width: element.style.width,
588   - height: element.style.height
589   - };
590   - return new Effect.Parallel(
591   - [ new Effect.Scale(element, 200,
592   - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
593   - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
594   - Object.extend({ duration: 1.0,
595   - beforeSetupInternal: function(effect) {
596   - Position.absolutize(effect.effects[0].element)
597   - },
598   - afterFinishInternal: function(effect) {
599   - effect.effects[0].element.hide().setStyle(oldStyle); }
600   - }, arguments[1] || {})
601   - );
602   -}
603   -
604   -Effect.BlindUp = function(element) {
605   - element = $(element);
606   - element.makeClipping();
607   - return new Effect.Scale(element, 0,
608   - Object.extend({ scaleContent: false,
609   - scaleX: false,
610   - restoreAfterFinish: true,
611   - afterFinishInternal: function(effect) {
612   - effect.element.hide().undoClipping();
613   - }
614   - }, arguments[1] || {})
615   - );
616   -}
617   -
618   -Effect.BlindDown = function(element) {
619   - element = $(element);
620   - var elementDimensions = element.getDimensions();
621   - return new Effect.Scale(element, 100, Object.extend({
622   - scaleContent: false,
623   - scaleX: false,
624   - scaleFrom: 0,
625   - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
626   - restoreAfterFinish: true,
627   - afterSetup: function(effect) {
628   - effect.element.makeClipping().setStyle({height: '0px'}).show();
629   - },
630   - afterFinishInternal: function(effect) {
631   - effect.element.undoClipping();
632   - }
633   - }, arguments[1] || {}));
634   -}
635   -
636   -Effect.SwitchOff = function(element) {
637   - element = $(element);
638   - var oldOpacity = element.getInlineOpacity();
639   - return new Effect.Appear(element, Object.extend({
640   - duration: 0.4,
641   - from: 0,
642   - transition: Effect.Transitions.flicker,
643   - afterFinishInternal: function(effect) {
644   - new Effect.Scale(effect.element, 1, {
645   - duration: 0.3, scaleFromCenter: true,
646   - scaleX: false, scaleContent: false, restoreAfterFinish: true,
647   - beforeSetup: function(effect) {
648   - effect.element.makePositioned().makeClipping();
649   - },
650   - afterFinishInternal: function(effect) {
651   - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
652   - }
653   - })
654   - }
655   - }, arguments[1] || {}));
656   -}
657   -
658   -Effect.DropOut = function(element) {
659   - element = $(element);
660   - var oldStyle = {
661   - top: element.getStyle('top'),
662   - left: element.getStyle('left'),
663   - opacity: element.getInlineOpacity() };
664   - return new Effect.Parallel(
665   - [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
666   - new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
667   - Object.extend(
668   - { duration: 0.5,
669   - beforeSetup: function(effect) {
670   - effect.effects[0].element.makePositioned();
671   - },
672   - afterFinishInternal: function(effect) {
673   - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
674   - }
675   - }, arguments[1] || {}));
676   -}
677   -
678   -Effect.Shake = function(element) {
679   - element = $(element);
680   - var oldStyle = {
681   - top: element.getStyle('top'),
682   - left: element.getStyle('left') };
683   - return new Effect.Move(element,
684   - { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
685   - new Effect.Move(effect.element,
686   - { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
687   - new Effect.Move(effect.element,
688   - { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
689   - new Effect.Move(effect.element,
690   - { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
691   - new Effect.Move(effect.element,
692   - { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
693   - new Effect.Move(effect.element,
694   - { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
695   - effect.element.undoPositioned().setStyle(oldStyle);
696   - }}) }}) }}) }}) }}) }});
697   -}
698   -
699   -Effect.SlideDown = function(element) {
700   - element = $(element).cleanWhitespace();
701   - // SlideDown need to have the content of the element wrapped in a container element with fixed height!
702   - var oldInnerBottom = element.down().getStyle('bottom');
703   - var elementDimensions = element.getDimensions();
704   - return new Effect.Scale(element, 100, Object.extend({
705   - scaleContent: false,
706   - scaleX: false,
707   - scaleFrom: window.opera ? 0 : 1,
708   - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
709   - restoreAfterFinish: true,
710   - afterSetup: function(effect) {
711   - effect.element.makePositioned();
712   - effect.element.down().makePositioned();
713   - if(window.opera) effect.element.setStyle({top: ''});
714   - effect.element.makeClipping().setStyle({height: '0px'}).show();
715   - },
716   - afterUpdateInternal: function(effect) {
717   - effect.element.down().setStyle({bottom:
718   - (effect.dims[0] - effect.element.clientHeight) + 'px' });
719   - },
720   - afterFinishInternal: function(effect) {
721   - effect.element.undoClipping().undoPositioned();
722   - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
723   - }, arguments[1] || {})
724   - );
725   -}
726   -
727   -Effect.SlideUp = function(element) {
728   - element = $(element).cleanWhitespace();
729   - var oldInnerBottom = element.down().getStyle('bottom');
730   - return new Effect.Scale(element, window.opera ? 0 : 1,
731   - Object.extend({ scaleContent: false,
732   - scaleX: false,
733   - scaleMode: 'box',
734   - scaleFrom: 100,
735   - restoreAfterFinish: true,
736   - beforeStartInternal: function(effect) {
737   - effect.element.makePositioned();
738   - effect.element.down().makePositioned();
739   - if(window.opera) effect.element.setStyle({top: ''});
740   - effect.element.makeClipping().show();
741   - },
742   - afterUpdateInternal: function(effect) {
743   - effect.element.down().setStyle({bottom:
744   - (effect.dims[0] - effect.element.clientHeight) + 'px' });
745   - },
746   - afterFinishInternal: function(effect) {
747   - effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom});
748   - effect.element.down().undoPositioned();
749   - }
750   - }, arguments[1] || {})
751   - );
752   -}
753   -
754   -// Bug in opera makes the TD containing this element expand for a instance after finish
755   -Effect.Squish = function(element) {
756   - return new Effect.Scale(element, window.opera ? 1 : 0, {
757   - restoreAfterFinish: true,
758   - beforeSetup: function(effect) {
759   - effect.element.makeClipping();
760   - },
761   - afterFinishInternal: function(effect) {
762   - effect.element.hide().undoClipping();
763   - }
764   - });
765   -}
766   -
767   -Effect.Grow = function(element) {
768   - element = $(element);
769   - var options = Object.extend({
770   - direction: 'center',
771   - moveTransition: Effect.Transitions.sinoidal,
772   - scaleTransition: Effect.Transitions.sinoidal,
773   - opacityTransition: Effect.Transitions.full
774   - }, arguments[1] || {});
775   - var oldStyle = {
776   - top: element.style.top,
777   - left: element.style.left,
778   - height: element.style.height,
779   - width: element.style.width,
780   - opacity: element.getInlineOpacity() };
781   -
782   - var dims = element.getDimensions();
783   - var initialMoveX, initialMoveY;
784   - var moveX, moveY;
785   -
786   - switch (options.direction) {
787   - case 'top-left':
788   - initialMoveX = initialMoveY = moveX = moveY = 0;
789   - break;
790   - case 'top-right':
791   - initialMoveX = dims.width;
792   - initialMoveY = moveY = 0;
793   - moveX = -dims.width;
794   - break;
795   - case 'bottom-left':
796   - initialMoveX = moveX = 0;
797   - initialMoveY = dims.height;
798   - moveY = -dims.height;
799   - break;
800   - case 'bottom-right':
801   - initialMoveX = dims.width;
802   - initialMoveY = dims.height;
803   - moveX = -dims.width;
804   - moveY = -dims.height;
805   - break;
806   - case 'center':
807   - initialMoveX = dims.width / 2;
808   - initialMoveY = dims.height / 2;
809   - moveX = -dims.width / 2;
810   - moveY = -dims.height / 2;
811   - break;
812   - }
813   -
814   - return new Effect.Move(element, {
815   - x: initialMoveX,
816   - y: initialMoveY,
817   - duration: 0.01,
818   - beforeSetup: function(effect) {
819   - effect.element.hide().makeClipping().makePositioned();
820   - },
821   - afterFinishInternal: function(effect) {
822   - new Effect.Parallel(
823   - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
824   - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
825   - new Effect.Scale(effect.element, 100, {
826   - scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
827   - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
828   - ], Object.extend({
829   - beforeSetup: function(effect) {
830   - effect.effects[0].element.setStyle({height: '0px'}).show();
831   - },
832   - afterFinishInternal: function(effect) {
833   - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
834   - }
835   - }, options)
836   - )
837   - }
838   - });
839   -}
840   -
841   -Effect.Shrink = function(element) {
842   - element = $(element);
843   - var options = Object.extend({
844   - direction: 'center',
845   - moveTransition: Effect.Transitions.sinoidal,
846   - scaleTransition: Effect.Transitions.sinoidal,
847   - opacityTransition: Effect.Transitions.none
848   - }, arguments[1] || {});
849   - var oldStyle = {
850   - top: element.style.top,
851   - left: element.style.left,
852   - height: element.style.height,
853   - width: element.style.width,
854   - opacity: element.getInlineOpacity() };
855   -
856   - var dims = element.getDimensions();
857   - var moveX, moveY;
858   -
859   - switch (options.direction) {
860   - case 'top-left':
861   - moveX = moveY = 0;
862   - break;
863   - case 'top-right':
864   - moveX = dims.width;
865   - moveY = 0;
866   - break;
867   - case 'bottom-left':
868   - moveX = 0;
869   - moveY = dims.height;
870   - break;
871   - case 'bottom-right':
872   - moveX = dims.width;
873   - moveY = dims.height;
874   - break;
875   - case 'center':
876   - moveX = dims.width / 2;
877   - moveY = dims.height / 2;
878   - break;
879   - }
880   -
881   - return new Effect.Parallel(
882   - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
883   - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
884   - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
885   - ], Object.extend({
886   - beforeStartInternal: function(effect) {
887   - effect.effects[0].element.makePositioned().makeClipping();
888   - },
889   - afterFinishInternal: function(effect) {
890   - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
891   - }, options)
892   - );
893   -}
894   -
895   -Effect.Pulsate = function(element) {
896   - element = $(element);
897   - var options = arguments[1] || {};
898   - var oldOpacity = element.getInlineOpacity();
899   - var transition = options.transition || Effect.Transitions.sinoidal;
900   - var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
901   - reverser.bind(transition);
902   - return new Effect.Opacity(element,
903   - Object.extend(Object.extend({ duration: 2.0, from: 0,
904   - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
905   - }, options), {transition: reverser}));
906   -}
907   -
908   -Effect.Fold = function(element) {
909   - element = $(element);
910   - var oldStyle = {
911   - top: element.style.top,
912   - left: element.style.left,
913   - width: element.style.width,
914   - height: element.style.height };
915   - element.makeClipping();
916   - return new Effect.Scale(element, 5, Object.extend({
917   - scaleContent: false,
918   - scaleX: false,
919   - afterFinishInternal: function(effect) {
920   - new Effect.Scale(element, 1, {
921   - scaleContent: false,
922   - scaleY: false,
923   - afterFinishInternal: function(effect) {
924   - effect.element.hide().undoClipping().setStyle(oldStyle);
925   - } });
926   - }}, arguments[1] || {}));
927   -};
928   -
929   -Effect.Morph = Class.create();
930   -Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
931   - initialize: function(element) {
932   - this.element = $(element);
933   - if(!this.element) throw(Effect._elementDoesNotExistError);
934   - var options = Object.extend({
935   - style: {}
936   - }, arguments[1] || {});
937   - if (typeof options.style == 'string') {
938   - if(options.style.indexOf(':') == -1) {
939   - var cssText = '', selector = '.' + options.style;
940   - $A(document.styleSheets).reverse().each(function(styleSheet) {
941   - if (styleSheet.cssRules) cssRules = styleSheet.cssRules;
942   - else if (styleSheet.rules) cssRules = styleSheet.rules;
943   - $A(cssRules).reverse().each(function(rule) {
944   - if (selector == rule.selectorText) {
945   - cssText = rule.style.cssText;
946   - throw $break;
947   - }
948   - });
949   - if (cssText) throw $break;
950   - });
951   - this.style = cssText.parseStyle();
952   - options.afterFinishInternal = function(effect){
953   - effect.element.addClassName(effect.options.style);
954   - effect.transforms.each(function(transform) {
955   - if(transform.style != 'opacity')
956   - effect.element.style[transform.style.camelize()] = '';
957   - });
958   - }
959   - } else this.style = options.style.parseStyle();
960   - } else this.style = $H(options.style)
961   - this.start(options);
962   - },
963   - setup: function(){
964   - function parseColor(color){
965   - if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
966   - color = color.parseColor();
967   - return $R(0,2).map(function(i){
968   - return parseInt( color.slice(i*2+1,i*2+3), 16 )
969   - });
970   - }
971   - this.transforms = this.style.map(function(pair){
972   - var property = pair[0].underscore().dasherize(), value = pair[1], unit = null;
973   -
974   - if(value.parseColor('#zzzzzz') != '#zzzzzz') {
975   - value = value.parseColor();
976   - unit = 'color';
977   - } else if(property == 'opacity') {
978   - value = parseFloat(value);
979   - if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout))
980   - this.element.setStyle({zoom: 1});
981   - } else if(Element.CSS_LENGTH.test(value))
982   - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/),
983   - value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null;
984   -
985   - var originalValue = this.element.getStyle(property);
986   - return $H({
987   - style: property,
988   - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
989   - targetValue: unit=='color' ? parseColor(value) : value,
990   - unit: unit
991   - });
992   - }.bind(this)).reject(function(transform){
993   - return (
994   - (transform.originalValue == transform.targetValue) ||
995   - (
996   - transform.unit != 'color' &&
997   - (isNaN(transform.originalValue) || isNaN(transform.targetValue))
998   - )
999   - )
1000   - });
1001   - },
1002   - update: function(position) {
1003   - var style = $H(), value = null;
1004   - this.transforms.each(function(transform){
1005   - value = transform.unit=='color' ?
1006   - $R(0,2).inject('#',function(m,v,i){
1007   - return m+(Math.round(transform.originalValue[i]+
1008   - (transform.targetValue[i] - transform.originalValue[i])*position)).toColorPart() }) :
1009   - transform.originalValue + Math.round(
1010   - ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit;
1011   - style[transform.style] = value;
1012   - });
1013   - this.element.setStyle(style);
1014   - }
1015   -});
1016   -
1017   -Effect.Transform = Class.create();
1018   -Object.extend(Effect.Transform.prototype, {
1019   - initialize: function(tracks){
1020   - this.tracks = [];
1021   - this.options = arguments[1] || {};
1022   - this.addTracks(tracks);
1023   - },
1024   - addTracks: function(tracks){
1025   - tracks.each(function(track){
1026   - var data = $H(track).values().first();
1027   - this.tracks.push($H({
1028   - ids: $H(track).keys().first(),
1029   - effect: Effect.Morph,
1030   - options: { style: data }
1031   - }));
1032   - }.bind(this));
1033   - return this;
1034   - },
1035   - play: function(){
1036   - return new Effect.Parallel(
1037   - this.tracks.map(function(track){
1038   - var elements = [$(track.ids) || $$(track.ids)].flatten();
1039   - return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) });
1040   - }).flatten(),
1041   - this.options
1042   - );
1043   - }
1044   -});
1045   -
1046   -Effect.SlideRightIntoView = function(element) {
1047   - $(element).style.width = '0px';
1048   - $(element).style.overflow = 'hidden';
1049   - $(element).firstChild.style.position = 'relative';
1050   - Element.show(element);
1051   - new Effect.Scale(element, 100,
1052   - Object.extend(arguments[1] || {}, {
1053   - scaleContent: false,
1054   - scaleY: false,
1055   - scaleMode: 'contents',
1056   - scaleFrom: 0,
1057   - afterUpdate: function(effect){}
1058   - })
1059   - );
1060   -}
1061   -
1062   -Effect.SlideRightOutOfView = function(element) {
1063   - $(element).style.overflow = 'hidden';
1064   - $(element).firstChild.style.position = 'relative';
1065   - Element.show(element);
1066   - new Effect.Scale(element, 0,
1067   - Object.extend(arguments[1] || {}, {
1068   - scaleContent: false,
1069   - scaleY: false,
1070   - afterUpdate: function(effect){},
1071   - afterFinish: function(effect)
1072   - { Element.hide(effect.element); }
1073   - })
1074   - );
1075   -}
1076   -
1077   -Effect.SlideLeftAndRight = function(element) {
1078   - element = $(element);
1079   - if(Element.visible(element)) new Effect.SlideRightOutOfView(element);
1080   - else new Effect.SlideRightIntoView(element);
1081   -}
1082   -
1083   -Effect.BlindLeft = function(element) {
1084   - element = $(element);
1085   - element.makeClipping();
1086   - return new Effect.Scale(element, 0,
1087   - Object.extend({ scaleContent: false,
1088   - scaleY: false,
1089   - restoreAfterFinish: true,
1090   - afterFinishInternal: function(effect) {
1091   - effect.element.hide().undoClipping();
1092   - }
1093   - }, arguments[1] || {})
1094   - );
1095   -}
1096   -
1097   -// CHANGES MADE FROM BLINDDOWN
1098   -// CHANGE from 'scaleX: false,' to scaleY: false
1099   -// CHANGE afterSetup function statement's "makeClipping().setStyle({height: '0px'})" to width: '0px'
1100   -
1101   -Effect.BlindRight = function(element) {
1102   - element = $(element);
1103   - var elementDimensions = element.getDimensions();
1104   - return new Effect.Scale(element, 100, Object.extend({
1105   - scaleContent: false,
1106   - scaleY: false,
1107   - scaleFrom: 0,
1108   - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
1109   - restoreAfterFinish: true,
1110   - afterSetup: function(effect) {
1111   - effect.element.makeClipping().setStyle({width: '0px'}).show();
1112   - },
1113   - afterFinishInternal: function(effect) {
1114   - effect.element.undoClipping();
1115   - }
1116   - }, arguments[1] || {}));
1117   -}
1118   -
1119   -/*
1120   -Effects.BlindRight($('someDivId')); //shows the div
1121   -Effects.BlindLeft($('someDivId')); //hides the div
1122   -*/
1123   -
1124   -Element.CSS_PROPERTIES = $w(
1125   - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
1126   - 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
1127   - 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
1128   - 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
1129   - 'fontSize fontWeight height left letterSpacing lineHeight ' +
1130   - 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
1131   - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
1132   - 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
1133   - 'right textIndent top width wordSpacing zIndex');
1134   -
1135   -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
1136   -
1137   -String.prototype.parseStyle = function(){
1138   - var element = Element.extend(document.createElement('div'));
1139   - element.innerHTML = '<div style="' + this + '"></div>';
1140   - var style = element.down().style, styleRules = $H();
1141   -
1142   - Element.CSS_PROPERTIES.each(function(property){
1143   - if(style[property]) styleRules[property] = style[property];
1144   - });
1145   - if(/MSIE/.test(navigator.userAgent) && !window.opera && this.indexOf('opacity') > -1) {
1146   - styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
1147   - }
1148   - return styleRules;
1149   -};
1150   -
1151   -Element.morph = function(element, style) {
1152   - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {}));
1153   - return element;
1154   -};
1155   -
1156   -['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
1157   - 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each(
1158   - function(f) { Element.Methods[f] = Element[f]; }
1159   -);
1160   -
1161   -Element.Methods.visualEffect = function(element, effect, options) {
1162   - s = effect.gsub(/_/, '-').camelize();
1163   - effect_class = s.charAt(0).toUpperCase() + s.substring(1);
1164   - new Effect[effect_class](element, options);
1165   - return $(element);
1166   -};
1167   -
1168   -Element.addMethods();
1169 0 \ No newline at end of file
ieducar/intranet/scripts/scriptaculous/prototype.js
... ... @@ -1,2515 +0,0 @@
1   -/* Prototype JavaScript framework, version 1.5.0
2   - * (c) 2005-2007 Sam Stephenson
3   - *
4   - * Prototype is freely distributable under the terms of an MIT-style license.
5   - * For details, see the Prototype web site: http://prototype.conio.net/
6   - *
7   -/*--------------------------------------------------------------------------*/
8   -
9   -var Prototype = {
10   - Version: '1.5.0',
11   - BrowserFeatures: {
12   - XPath: !!document.evaluate
13   - },
14   -
15   - ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
16   - emptyFunction: function() {},
17   - K: function(x) { return x }
18   -}
19   -
20   -var Class = {
21   - create: function() {
22   - return function() {
23   - this.initialize.apply(this, arguments);
24   - }
25   - }
26   -}
27   -
28   -var Abstract = new Object();
29   -
30   -Object.extend = function(destination, source) {
31   - for (var property in source) {
32   - destination[property] = source[property];
33   - }
34   - return destination;
35   -}
36   -
37   -Object.extend(Object, {
38   - inspect: function(object) {
39   - try {
40   - if (object === undefined) return 'undefined';
41   - if (object === null) return 'null';
42   - return object.inspect ? object.inspect() : object.toString();
43   - } catch (e) {
44   - if (e instanceof RangeError) return '...';
45   - throw e;
46   - }
47   - },
48   -
49   - keys: function(object) {
50   - var keys = [];
51   - for (var property in object)
52   - keys.push(property);
53   - return keys;
54   - },
55   -
56   - values: function(object) {
57   - var values = [];
58   - for (var property in object)
59   - values.push(object[property]);
60   - return values;
61   - },
62   -
63   - clone: function(object) {
64   - return Object.extend({}, object);
65   - }
66   -});
67   -
68   -Function.prototype.bind = function() {
69   - var __method = this, args = $A(arguments), object = args.shift();
70   - return function() {
71   - return __method.apply(object, args.concat($A(arguments)));
72   - }
73   -}
74   -
75   -Function.prototype.bindAsEventListener = function(object) {
76   - var __method = this, args = $A(arguments), object = args.shift();
77   - return function(event) {
78   - return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
79   - }
80   -}
81   -
82   -Object.extend(Number.prototype, {
83   - toColorPart: function() {
84   - var digits = this.toString(16);
85   - if (this < 16) return '0' + digits;
86   - return digits;
87   - },
88   -
89   - succ: function() {
90   - return this + 1;
91   - },
92   -
93   - times: function(iterator) {
94   - $R(0, this, true).each(iterator);
95   - return this;
96   - }
97   -});
98   -
99   -var Try = {
100   - these: function() {
101   - var returnValue;
102   -
103   - for (var i = 0, length = arguments.length; i < length; i++) {
104   - var lambda = arguments[i];
105   - try {
106   - returnValue = lambda();
107   - break;
108   - } catch (e) {}
109   - }
110   -
111   - return returnValue;
112   - }
113   -}
114   -
115   -/*--------------------------------------------------------------------------*/
116   -
117   -var PeriodicalExecuter = Class.create();
118   -PeriodicalExecuter.prototype = {
119   - initialize: function(callback, frequency) {
120   - this.callback = callback;
121   - this.frequency = frequency;
122   - this.currentlyExecuting = false;
123   -
124   - this.registerCallback();
125   - },
126   -
127   - registerCallback: function() {
128   - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
129   - },
130   -
131   - stop: function() {
132   - if (!this.timer) return;
133   - clearInterval(this.timer);
134   - this.timer = null;
135   - },
136   -
137   - onTimerEvent: function() {
138   - if (!this.currentlyExecuting) {
139   - try {
140   - this.currentlyExecuting = true;
141   - this.callback(this);
142   - } finally {
143   - this.currentlyExecuting = false;
144   - }
145   - }
146   - }
147   -}
148   -String.interpret = function(value){
149   - return value == null ? '' : String(value);
150   -}
151   -
152   -Object.extend(String.prototype, {
153   - gsub: function(pattern, replacement) {
154   - var result = '', source = this, match;
155   - replacement = arguments.callee.prepareReplacement(replacement);
156   -
157   - while (source.length > 0) {
158   - if (match = source.match(pattern)) {
159   - result += source.slice(0, match.index);
160   - result += String.interpret(replacement(match));
161   - source = source.slice(match.index + match[0].length);
162   - } else {
163   - result += source, source = '';
164   - }
165   - }
166   - return result;
167   - },
168   -
169   - sub: function(pattern, replacement, count) {
170   - replacement = this.gsub.prepareReplacement(replacement);
171   - count = count === undefined ? 1 : count;
172   -
173   - return this.gsub(pattern, function(match) {
174   - if (--count < 0) return match[0];
175   - return replacement(match);
176   - });
177   - },
178   -
179   - scan: function(pattern, iterator) {
180   - this.gsub(pattern, iterator);
181   - return this;
182   - },
183   -
184   - truncate: function(length, truncation) {
185   - length = length || 30;
186   - truncation = truncation === undefined ? '...' : truncation;
187   - return this.length > length ?
188   - this.slice(0, length - truncation.length) + truncation : this;
189   - },
190   -
191   - strip: function() {
192   - return this.replace(/^\s+/, '').replace(/\s+$/, '');
193   - },
194   -
195   - stripTags: function() {
196   - return this.replace(/<\/?[^>]+>/gi, '');
197   - },
198   -
199   - stripScripts: function() {
200   - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
201   - },
202   -
203   - extractScripts: function() {
204   - var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
205   - var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
206   - return (this.match(matchAll) || []).map(function(scriptTag) {
207   - return (scriptTag.match(matchOne) || ['', ''])[1];
208   - });
209   - },
210   -
211   - evalScripts: function() {
212   - return this.extractScripts().map(function(script) { return eval(script) });
213   - },
214   -
215   - escapeHTML: function() {
216   - var div = document.createElement('div');
217   - var text = document.createTextNode(this);
218   - div.appendChild(text);
219   - return div.innerHTML;
220   - },
221   -
222   - unescapeHTML: function() {
223   - var div = document.createElement('div');
224   - div.innerHTML = this.stripTags();
225   - return div.childNodes[0] ? (div.childNodes.length > 1 ?
226   - $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
227   - div.childNodes[0].nodeValue) : '';
228   - },
229   -
230   - toQueryParams: function(separator) {
231   - var match = this.strip().match(/([^?#]*)(#.*)?$/);
232   - if (!match) return {};
233   -
234   - return match[1].split(separator || '&').inject({}, function(hash, pair) {
235   - if ((pair = pair.split('='))[0]) {
236   - var name = decodeURIComponent(pair[0]);
237   - var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;
238   -
239   - if (hash[name] !== undefined) {
240   - if (hash[name].constructor != Array)
241   - hash[name] = [hash[name]];
242   - if (value) hash[name].push(value);
243   - }
244   - else hash[name] = value;
245   - }
246   - return hash;
247   - });
248   - },
249   -
250   - toArray: function() {
251   - return this.split('');
252   - },
253   -
254   - succ: function() {
255   - return this.slice(0, this.length - 1) +
256   - String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
257   - },
258   -
259   - camelize: function() {
260   - var parts = this.split('-'), len = parts.length;
261   - if (len == 1) return parts[0];
262   -
263   - var camelized = this.charAt(0) == '-'
264   - ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
265   - : parts[0];
266   -
267   - for (var i = 1; i < len; i++)
268   - camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
269   -
270   - return camelized;
271   - },
272   -
273   - capitalize: function(){
274   - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
275   - },
276   -
277   - underscore: function() {
278   - return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
279   - },
280   -
281   - dasherize: function() {
282   - return this.gsub(/_/,'-');
283   - },
284   -
285   - inspect: function(useDoubleQuotes) {
286   - var escapedString = this.replace(/\\/g, '\\\\');
287   - if (useDoubleQuotes)
288   - return '"' + escapedString.replace(/"/g, '\\"') + '"';
289   - else
290   - return "'" + escapedString.replace(/'/g, '\\\'') + "'";
291   - }
292   -});
293   -
294   -String.prototype.gsub.prepareReplacement = function(replacement) {
295   - if (typeof replacement == 'function') return replacement;
296   - var template = new Template(replacement);
297   - return function(match) { return template.evaluate(match) };
298   -}
299   -
300   -String.prototype.parseQuery = String.prototype.toQueryParams;
301   -
302   -var Template = Class.create();
303   -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
304   -Template.prototype = {
305   - initialize: function(template, pattern) {
306   - this.template = template.toString();
307   - this.pattern = pattern || Template.Pattern;
308   - },
309   -
310   - evaluate: function(object) {
311   - return this.template.gsub(this.pattern, function(match) {
312   - var before = match[1];
313   - if (before == '\\') return match[2];
314   - return before + String.interpret(object[match[3]]);
315   - });
316   - }
317   -}
318   -
319   -var $break = new Object();
320   -var $continue = new Object();
321   -
322   -var Enumerable = {
323   - each: function(iterator) {
324   - var index = 0;
325   - try {
326   - this._each(function(value) {
327   - try {
328   - iterator(value, index++);
329   - } catch (e) {
330   - if (e != $continue) throw e;
331   - }
332   - });
333   - } catch (e) {
334   - if (e != $break) throw e;
335   - }
336   - return this;
337   - },
338   -
339   - eachSlice: function(number, iterator) {
340   - var index = -number, slices = [], array = this.toArray();
341   - while ((index += number) < array.length)
342   - slices.push(array.slice(index, index+number));
343   - return slices.map(iterator);
344   - },
345   -
346   - all: function(iterator) {
347   - var result = true;
348   - this.each(function(value, index) {
349   - result = result && !!(iterator || Prototype.K)(value, index);
350   - if (!result) throw $break;
351   - });
352   - return result;
353   - },
354   -
355   - any: function(iterator) {
356   - var result = false;
357   - this.each(function(value, index) {
358   - if (result = !!(iterator || Prototype.K)(value, index))
359   - throw $break;
360   - });
361   - return result;
362   - },
363   -
364   - collect: function(iterator) {
365   - var results = [];
366   - this.each(function(value, index) {
367   - results.push((iterator || Prototype.K)(value, index));
368   - });
369   - return results;
370   - },
371   -
372   - detect: function(iterator) {
373   - var result;
374   - this.each(function(value, index) {
375   - if (iterator(value, index)) {
376   - result = value;
377   - throw $break;
378   - }
379   - });
380   - return result;
381   - },
382   -
383   - findAll: function(iterator) {
384   - var results = [];
385   - this.each(function(value, index) {
386   - if (iterator(value, index))
387   - results.push(value);
388   - });
389   - return results;
390   - },
391   -
392   - grep: function(pattern, iterator) {
393   - var results = [];
394   - this.each(function(value, index) {
395   - var stringValue = value.toString();
396   - if (stringValue.match(pattern))
397   - results.push((iterator || Prototype.K)(value, index));
398   - })
399   - return results;
400   - },
401   -
402   - include: function(object) {
403   - var found = false;
404   - this.each(function(value) {
405   - if (value == object) {
406   - found = true;
407   - throw $break;
408   - }
409   - });
410   - return found;
411   - },
412   -
413   - inGroupsOf: function(number, fillWith) {
414   - fillWith = fillWith === undefined ? null : fillWith;
415   - return this.eachSlice(number, function(slice) {
416   - while(slice.length < number) slice.push(fillWith);
417   - return slice;
418   - });
419   - },
420   -
421   - inject: function(memo, iterator) {
422   - this.each(function(value, index) {
423   - memo = iterator(memo, value, index);
424   - });
425   - return memo;
426   - },
427   -
428   - invoke: function(method) {
429   - var args = $A(arguments).slice(1);
430   - return this.map(function(value) {
431   - return value[method].apply(value, args);
432   - });
433   - },
434   -
435   - max: function(iterator) {
436   - var result;
437   - this.each(function(value, index) {
438   - value = (iterator || Prototype.K)(value, index);
439   - if (result == undefined || value >= result)
440   - result = value;
441   - });
442   - return result;
443   - },
444   -
445   - min: function(iterator) {
446   - var result;
447   - this.each(function(value, index) {
448   - value = (iterator || Prototype.K)(value, index);
449   - if (result == undefined || value < result)
450   - result = value;
451   - });
452   - return result;
453   - },
454   -
455   - partition: function(iterator) {
456   - var trues = [], falses = [];
457   - this.each(function(value, index) {
458   - ((iterator || Prototype.K)(value, index) ?
459   - trues : falses).push(value);
460   - });
461   - return [trues, falses];
462   - },
463   -
464   - pluck: function(property) {
465   - var results = [];
466   - this.each(function(value, index) {
467   - results.push(value[property]);
468   - });
469   - return results;
470   - },
471   -
472   - reject: function(iterator) {
473   - var results = [];
474   - this.each(function(value, index) {
475   - if (!iterator(value, index))
476   - results.push(value);
477   - });
478   - return results;
479   - },
480   -
481   - sortBy: function(iterator) {
482   - return this.map(function(value, index) {
483   - return {value: value, criteria: iterator(value, index)};
484   - }).sort(function(left, right) {
485   - var a = left.criteria, b = right.criteria;
486   - return a < b ? -1 : a > b ? 1 : 0;
487   - }).pluck('value');
488   - },
489   -
490   - toArray: function() {
491   - return this.map();
492   - },
493   -
494   - zip: function() {
495   - var iterator = Prototype.K, args = $A(arguments);
496   - if (typeof args.last() == 'function')
497   - iterator = args.pop();
498   -
499   - var collections = [this].concat(args).map($A);
500   - return this.map(function(value, index) {
501   - return iterator(collections.pluck(index));
502   - });
503   - },
504   -
505   - size: function() {
506   - return this.toArray().length;
507   - },
508   -
509   - inspect: function() {
510   - return '#<Enumerable:' + this.toArray().inspect() + '>';
511   - }
512   -}
513   -
514   -Object.extend(Enumerable, {
515   - map: Enumerable.collect,
516   - find: Enumerable.detect,
517   - select: Enumerable.findAll,
518   - member: Enumerable.include,
519   - entries: Enumerable.toArray
520   -});
521   -var $A = Array.from = function(iterable) {
522   - if (!iterable) return [];
523   - if (iterable.toArray) {
524   - return iterable.toArray();
525   - } else {
526   - var results = [];
527   - for (var i = 0, length = iterable.length; i < length; i++)
528   - results.push(iterable[i]);
529   - return results;
530   - }
531   -}
532   -
533   -Object.extend(Array.prototype, Enumerable);
534   -
535   -if (!Array.prototype._reverse)
536   - Array.prototype._reverse = Array.prototype.reverse;
537   -
538   -Object.extend(Array.prototype, {
539   - _each: function(iterator) {
540   - for (var i = 0, length = this.length; i < length; i++)
541   - iterator(this[i]);
542   - },
543   -
544   - clear: function() {
545   - this.length = 0;
546   - return this;
547   - },
548   -
549   - first: function() {
550   - return this[0];
551   - },
552   -
553   - last: function() {
554   - return this[this.length - 1];
555   - },
556   -
557   - compact: function() {
558   - return this.select(function(value) {
559   - return value != null;
560   - });
561   - },
562   -
563   - flatten: function() {
564   - return this.inject([], function(array, value) {
565   - return array.concat(value && value.constructor == Array ?
566   - value.flatten() : [value]);
567   - });
568   - },
569   -
570   - without: function() {
571   - var values = $A(arguments);
572   - return this.select(function(value) {
573   - return !values.include(value);
574   - });
575   - },
576   -
577   - indexOf: function(object) {
578   - for (var i = 0, length = this.length; i < length; i++)
579   - if (this[i] == object) return i;
580   - return -1;
581   - },
582   -
583   - reverse: function(inline) {
584   - return (inline !== false ? this : this.toArray())._reverse();
585   - },
586   -
587   - reduce: function() {
588   - return this.length > 1 ? this : this[0];
589   - },
590   -
591   - uniq: function() {
592   - return this.inject([], function(array, value) {
593   - return array.include(value) ? array : array.concat([value]);
594   - });
595   - },
596   -
597   - clone: function() {
598   - return [].concat(this);
599   - },
600   -
601   - size: function() {
602   - return this.length;
603   - },
604   -
605   - inspect: function() {
606   - return '[' + this.map(Object.inspect).join(', ') + ']';
607   - }
608   -});
609   -
610   -Array.prototype.toArray = Array.prototype.clone;
611   -
612   -function $w(string){
613   - string = string.strip();
614   - return string ? string.split(/\s+/) : [];
615   -}
616   -
617   -if(window.opera){
618   - Array.prototype.concat = function(){
619   - var array = [];
620   - for(var i = 0, length = this.length; i < length; i++) array.push(this[i]);
621   - for(var i = 0, length = arguments.length; i < length; i++) {
622   - if(arguments[i].constructor == Array) {
623   - for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
624   - array.push(arguments[i][j]);
625   - } else {
626   - array.push(arguments[i]);
627   - }
628   - }
629   - return array;
630   - }
631   -}
632   -var Hash = function(obj) {
633   - Object.extend(this, obj || {});
634   -};
635   -
636   -Object.extend(Hash, {
637   - toQueryString: function(obj) {
638   - var parts = [];
639   -
640   - this.prototype._each.call(obj, function(pair) {
641   - if (!pair.key) return;
642   -
643   - if (pair.value && pair.value.constructor == Array) {
644   - var values = pair.value.compact();
645   - if (values.length < 2) pair.value = values.reduce();
646   - else {
647   - key = encodeURIComponent(pair.key);
648   - values.each(function(value) {
649   - value = value != undefined ? encodeURIComponent(value) : '';
650   - parts.push(key + '=' + encodeURIComponent(value));
651   - });
652   - return;
653   - }
654   - }
655   - if (pair.value == undefined) pair[1] = '';
656   - parts.push(pair.map(encodeURIComponent).join('='));
657   - });
658   -
659   - return parts.join('&');
660   - }
661   -});
662   -
663   -Object.extend(Hash.prototype, Enumerable);
664   -Object.extend(Hash.prototype, {
665   - _each: function(iterator) {
666   - for (var key in this) {
667   - var value = this[key];
668   - if (value && value == Hash.prototype[key]) continue;
669   -
670   - var pair = [key, value];
671   - pair.key = key;
672   - pair.value = value;
673   - iterator(pair);
674   - }
675   - },
676   -
677   - keys: function() {
678   - return this.pluck('key');
679   - },
680   -
681   - values: function() {
682   - return this.pluck('value');
683   - },
684   -
685   - merge: function(hash) {
686   - return $H(hash).inject(this, function(mergedHash, pair) {
687   - mergedHash[pair.key] = pair.value;
688   - return mergedHash;
689   - });
690   - },
691   -
692   - remove: function() {
693   - var result;
694   - for(var i = 0, length = arguments.length; i < length; i++) {
695   - var value = this[arguments[i]];
696   - if (value !== undefined){
697   - if (result === undefined) result = value;
698   - else {
699   - if (result.constructor != Array) result = [result];
700   - result.push(value)
701   - }
702   - }
703   - delete this[arguments[i]];
704   - }
705   - return result;
706   - },
707   -
708   - toQueryString: function() {
709   - return Hash.toQueryString(this);
710   - },
711   -
712   - inspect: function() {
713   - return '#<Hash:{' + this.map(function(pair) {
714   - return pair.map(Object.inspect).join(': ');
715   - }).join(', ') + '}>';
716   - }
717   -});
718   -
719   -function $H(object) {
720   - if (object && object.constructor == Hash) return object;
721   - return new Hash(object);
722   -};
723   -ObjectRange = Class.create();
724   -Object.extend(ObjectRange.prototype, Enumerable);
725   -Object.extend(ObjectRange.prototype, {
726   - initialize: function(start, end, exclusive) {
727   - this.start = start;
728   - this.end = end;
729   - this.exclusive = exclusive;
730   - },
731   -
732   - _each: function(iterator) {
733   - var value = this.start;
734   - while (this.include(value)) {
735   - iterator(value);
736   - value = value.succ();
737   - }
738   - },
739   -
740   - include: function(value) {
741   - if (value < this.start)
742   - return false;
743   - if (this.exclusive)
744   - return value < this.end;
745   - return value <= this.end;
746   - }
747   -});
748   -
749   -var $R = function(start, end, exclusive) {
750   - return new ObjectRange(start, end, exclusive);
751   -}
752   -
753   -var Ajax = {
754   - getTransport: function() {
755   - return Try.these(
756   - function() {return new XMLHttpRequest()},
757   - function() {return new ActiveXObject('Msxml2.XMLHTTP')},
758   - function() {return new ActiveXObject('Microsoft.XMLHTTP')}
759   - ) || false;
760   - },
761   -
762   - activeRequestCount: 0
763   -}
764   -
765   -Ajax.Responders = {
766   - responders: [],
767   -
768   - _each: function(iterator) {
769   - this.responders._each(iterator);
770   - },
771   -
772   - register: function(responder) {
773   - if (!this.include(responder))
774   - this.responders.push(responder);
775   - },
776   -
777   - unregister: function(responder) {
778   - this.responders = this.responders.without(responder);
779   - },
780   -
781   - dispatch: function(callback, request, transport, json) {
782   - this.each(function(responder) {
783   - if (typeof responder[callback] == 'function') {
784   - try {
785   - responder[callback].apply(responder, [request, transport, json]);
786   - } catch (e) {}
787   - }
788   - });
789   - }
790   -};
791   -
792   -Object.extend(Ajax.Responders, Enumerable);
793   -
794   -Ajax.Responders.register({
795   - onCreate: function() {
796   - Ajax.activeRequestCount++;
797   - },
798   - onComplete: function() {
799   - Ajax.activeRequestCount--;
800   - }
801   -});
802   -
803   -Ajax.Base = function() {};
804   -Ajax.Base.prototype = {
805   - setOptions: function(options) {
806   - this.options = {
807   - method: 'post',
808   - asynchronous: true,
809   - contentType: 'application/x-www-form-urlencoded',
810   - encoding: 'UTF-8',
811   - parameters: ''
812   - }
813   - Object.extend(this.options, options || {});
814   -
815   - this.options.method = this.options.method.toLowerCase();
816   - if (typeof this.options.parameters == 'string')
817   - this.options.parameters = this.options.parameters.toQueryParams();
818   - }
819   -}
820   -
821   -Ajax.Request = Class.create();
822   -Ajax.Request.Events =
823   - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
824   -
825   -Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
826   - _complete: false,
827   -
828   - initialize: function(url, options) {
829   - this.transport = Ajax.getTransport();
830   - this.setOptions(options);
831   - this.request(url);
832   - },
833   -
834   - request: function(url) {
835   - this.url = url;
836   - this.method = this.options.method;
837   - var params = this.options.parameters;
838   -
839   - if (!['get', 'post'].include(this.method)) {
840   - // simulate other verbs over post
841   - params['_method'] = this.method;
842   - this.method = 'post';
843   - }
844   -
845   - params = Hash.toQueryString(params);
846   - if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='
847   -
848   - // when GET, append parameters to URL
849   - if (this.method == 'get' && params)
850   - this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params;
851   -
852   - try {
853   - Ajax.Responders.dispatch('onCreate', this, this.transport);
854   -
855   - this.transport.open(this.method.toUpperCase(), this.url,
856   - this.options.asynchronous);
857   -
858   - if (this.options.asynchronous)
859   - setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
860   -
861   - this.transport.onreadystatechange = this.onStateChange.bind(this);
862   - this.setRequestHeaders();
863   -
864   - var body = this.method == 'post' ? (this.options.postBody || params) : null;
865   -
866   - this.transport.send(body);
867   -
868   - /* Force Firefox to handle ready state 4 for synchronous requests */
869   - if (!this.options.asynchronous && this.transport.overrideMimeType)
870   - this.onStateChange();
871   -
872   - }
873   - catch (e) {
874   - this.dispatchException(e);
875   - }
876   - },
877   -
878   - onStateChange: function() {
879   - var readyState = this.transport.readyState;
880   - if (readyState > 1 && !((readyState == 4) && this._complete))
881   - this.respondToReadyState(this.transport.readyState);
882   - },
883   -
884   - setRequestHeaders: function() {
885   - var headers = {
886   - 'X-Requested-With': 'XMLHttpRequest',
887   - 'X-Prototype-Version': Prototype.Version,
888   - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
889   - };
890   -
891   - if (this.method == 'post') {
892   - headers['Content-type'] = this.options.contentType +
893   - (this.options.encoding ? '; charset=' + this.options.encoding : '');
894   -
895   - /* Force "Connection: close" for older Mozilla browsers to work
896   - * around a bug where XMLHttpRequest sends an incorrect
897   - * Content-length header. See Mozilla Bugzilla #246651.
898   - */
899   - if (this.transport.overrideMimeType &&
900   - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
901   - headers['Connection'] = 'close';
902   - }
903   -
904   - // user-defined headers
905   - if (typeof this.options.requestHeaders == 'object') {
906   - var extras = this.options.requestHeaders;
907   -
908   - if (typeof extras.push == 'function')
909   - for (var i = 0, length = extras.length; i < length; i += 2)
910   - headers[extras[i]] = extras[i+1];
911   - else
912   - $H(extras).each(function(pair) { headers[pair.key] = pair.value });
913   - }
914   -
915   - for (var name in headers)
916   - this.transport.setRequestHeader(name, headers[name]);
917   - },
918   -
919   - success: function() {
920   - return !this.transport.status
921   - || (this.transport.status >= 200 && this.transport.status < 300);
922   - },
923   -
924   - respondToReadyState: function(readyState) {
925   - var state = Ajax.Request.Events[readyState];
926   - var transport = this.transport, json = this.evalJSON();
927   -
928   - if (state == 'Complete') {
929   - try {
930   - this._complete = true;
931   - (this.options['on' + this.transport.status]
932   - || this.options['on' + (this.success() ? 'Success' : 'Failure')]
933   - || Prototype.emptyFunction)(transport, json);
934   - } catch (e) {
935   - this.dispatchException(e);
936   - }
937   -
938   - if ((this.getHeader('Content-type') || 'text/javascript').strip().
939   - match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
940   - this.evalResponse();
941   - }
942   -
943   - try {
944   - (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
945   - Ajax.Responders.dispatch('on' + state, this, transport, json);
946   - } catch (e) {
947   - this.dispatchException(e);
948   - }
949   -
950   - if (state == 'Complete') {
951   - // avoid memory leak in MSIE: clean up
952   - this.transport.onreadystatechange = Prototype.emptyFunction;
953   - }
954   - },
955   -
956   - getHeader: function(name) {
957   - try {
958   - return this.transport.getResponseHeader(name);
959   - } catch (e) { return null }
960   - },
961   -
962   - evalJSON: function() {
963   - try {
964   - var json = this.getHeader('X-JSON');
965   - return json ? eval('(' + json + ')') : null;
966   - } catch (e) { return null }
967   - },
968   -
969   - evalResponse: function() {
970   - try {
971   - return eval(this.transport.responseText);
972   - } catch (e) {
973   - this.dispatchException(e);
974   - }
975   - },
976   -
977   - dispatchException: function(exception) {
978   - (this.options.onException || Prototype.emptyFunction)(this, exception);
979   - Ajax.Responders.dispatch('onException', this, exception);
980   - }
981   -});
982   -
983   -Ajax.Updater = Class.create();
984   -
985   -Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
986   - initialize: function(container, url, options) {
987   - this.container = {
988   - success: (container.success || container),
989   - failure: (container.failure || (container.success ? null : container))
990   - }
991   -
992   - this.transport = Ajax.getTransport();
993   - this.setOptions(options);
994   -
995   - var onComplete = this.options.onComplete || Prototype.emptyFunction;
996   - this.options.onComplete = (function(transport, param) {
997   - this.updateContent();
998   - onComplete(transport, param);
999   - }).bind(this);
1000   -
1001   - this.request(url);
1002   - },
1003   -
1004   - updateContent: function() {
1005   - var receiver = this.container[this.success() ? 'success' : 'failure'];
1006   - var response = this.transport.responseText;
1007   -
1008   - if (!this.options.evalScripts) response = response.stripScripts();
1009   -
1010   - if (receiver = $(receiver)) {
1011   - if (this.options.insertion)
1012   - new this.options.insertion(receiver, response);
1013   - else
1014   - receiver.update(response);
1015   - }
1016   -
1017   - if (this.success()) {
1018   - if (this.onComplete)
1019   - setTimeout(this.onComplete.bind(this), 10);
1020   - }
1021   - }
1022   -});
1023   -
1024   -Ajax.PeriodicalUpdater = Class.create();
1025   -Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
1026   - initialize: function(container, url, options) {
1027   - this.setOptions(options);
1028   - this.onComplete = this.options.onComplete;
1029   -
1030   - this.frequency = (this.options.frequency || 2);
1031   - this.decay = (this.options.decay || 1);
1032   -
1033   - this.updater = {};
1034   - this.container = container;
1035   - this.url = url;
1036   -
1037   - this.start();
1038   - },
1039   -
1040   - start: function() {
1041   - this.options.onComplete = this.updateComplete.bind(this);
1042   - this.onTimerEvent();
1043   - },
1044   -
1045   - stop: function() {
1046   - this.updater.options.onComplete = undefined;
1047   - clearTimeout(this.timer);
1048   - (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
1049   - },
1050   -
1051   - updateComplete: function(request) {
1052   - if (this.options.decay) {
1053   - this.decay = (request.responseText == this.lastText ?
1054   - this.decay * this.options.decay : 1);
1055   -
1056   - this.lastText = request.responseText;
1057   - }
1058   - this.timer = setTimeout(this.onTimerEvent.bind(this),
1059   - this.decay * this.frequency * 1000);
1060   - },
1061   -
1062   - onTimerEvent: function() {
1063   - this.updater = new Ajax.Updater(this.container, this.url, this.options);
1064   - }
1065   -});
1066   -function $(element) {
1067   - if (arguments.length > 1) {
1068   - for (var i = 0, elements = [], length = arguments.length; i < length; i++)
1069   - elements.push($(arguments[i]));
1070   - return elements;
1071   - }
1072   - if (typeof element == 'string')
1073   - element = document.getElementById(element);
1074   - return Element.extend(element);
1075   -}
1076   -
1077   -if (Prototype.BrowserFeatures.XPath) {
1078   - document._getElementsByXPath = function(expression, parentElement) {
1079   - var results = [];
1080   - var query = document.evaluate(expression, $(parentElement) || document,
1081   - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
1082   - for (var i = 0, length = query.snapshotLength; i < length; i++)
1083   - results.push(query.snapshotItem(i));
1084   - return results;
1085   - };
1086   -}
1087   -
1088   -document.getElementsByClassName = function(className, parentElement) {
1089   - if (Prototype.BrowserFeatures.XPath) {
1090   - var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
1091   - return document._getElementsByXPath(q, parentElement);
1092   - } else {
1093   - var children = ($(parentElement) || document.body).getElementsByTagName('*');
1094   - var elements = [], child;
1095   - for (var i = 0, length = children.length; i < length; i++) {
1096   - child = children[i];
1097   - if (Element.hasClassName(child, className))
1098   - elements.push(Element.extend(child));
1099   - }
1100   - return elements;
1101   - }
1102   -};
1103   -
1104   -/*--------------------------------------------------------------------------*/
1105   -
1106   -if (!window.Element)
1107   - var Element = new Object();
1108   -
1109   -Element.extend = function(element) {
1110   - if (!element || _nativeExtensions || element.nodeType == 3) return element;
1111   -
1112   - if (!element._extended && element.tagName && element != window) {
1113   - var methods = Object.clone(Element.Methods), cache = Element.extend.cache;
1114   -
1115   - if (element.tagName == 'FORM')
1116   - Object.extend(methods, Form.Methods);
1117   - if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName))
1118   - Object.extend(methods, Form.Element.Methods);
1119   -
1120   - Object.extend(methods, Element.Methods.Simulated);
1121   -
1122   - for (var property in methods) {
1123   - var value = methods[property];
1124   - if (typeof value == 'function' && !(property in element))
1125   - element[property] = cache.findOrStore(value);
1126   - }
1127   - }
1128   -
1129   - element._extended = true;
1130   - return element;
1131   -};
1132   -
1133   -Element.extend.cache = {
1134   - findOrStore: function(value) {
1135   - return this[value] = this[value] || function() {
1136   - return value.apply(null, [this].concat($A(arguments)));
1137   - }
1138   - }
1139   -};
1140   -
1141   -Element.Methods = {
1142   - visible: function(element) {
1143   - return $(element).style.display != 'none';
1144   - },
1145   -
1146   - toggle: function(element) {
1147   - element = $(element);
1148   - Element[Element.visible(element) ? 'hide' : 'show'](element);
1149   - return element;
1150   - },
1151   -
1152   - hide: function(element) {
1153   - $(element).style.display = 'none';
1154   - return element;
1155   - },
1156   -
1157   - show: function(element) {
1158   - $(element).style.display = '';
1159   - return element;
1160   - },
1161   -
1162   - remove: function(element) {
1163   - element = $(element);
1164   - element.parentNode.removeChild(element);
1165   - return element;
1166   - },
1167   -
1168   - update: function(element, html) {
1169   - html = typeof html == 'undefined' ? '' : html.toString();
1170   - $(element).innerHTML = html.stripScripts();
1171   - setTimeout(function() {html.evalScripts()}, 10);
1172   - return element;
1173   - },
1174   -
1175   - replace: function(element, html) {
1176   - element = $(element);
1177   - html = typeof html == 'undefined' ? '' : html.toString();
1178   - if (element.outerHTML) {
1179   - element.outerHTML = html.stripScripts();
1180   - } else {
1181   - var range = element.ownerDocument.createRange();
1182   - range.selectNodeContents(element);
1183   - element.parentNode.replaceChild(
1184   - range.createContextualFragment(html.stripScripts()), element);
1185   - }
1186   - setTimeout(function() {html.evalScripts()}, 10);
1187   - return element;
1188   - },
1189   -
1190   - inspect: function(element) {
1191   - element = $(element);
1192   - var result = '<' + element.tagName.toLowerCase();
1193   - $H({'id': 'id', 'className': 'class'}).each(function(pair) {
1194   - var property = pair.first(), attribute = pair.last();
1195   - var value = (element[property] || '').toString();
1196   - if (value) result += ' ' + attribute + '=' + value.inspect(true);
1197   - });
1198   - return result + '>';
1199   - },
1200   -
1201   - recursivelyCollect: function(element, property) {
1202   - element = $(element);
1203   - var elements = [];
1204   - while (element = element[property])
1205   - if (element.nodeType == 1)
1206   - elements.push(Element.extend(element));
1207   - return elements;
1208   - },
1209   -
1210   - ancestors: function(element) {
1211   - return $(element).recursivelyCollect('parentNode');
1212   - },
1213   -
1214   - descendants: function(element) {
1215   - return $A($(element).getElementsByTagName('*'));
1216   - },
1217   -
1218   - immediateDescendants: function(element) {
1219   - if (!(element = $(element).firstChild)) return [];
1220   - while (element && element.nodeType != 1) element = element.nextSibling;
1221   - if (element) return [element].concat($(element).nextSiblings());
1222   - return [];
1223   - },
1224   -
1225   - previousSiblings: function(element) {
1226   - return $(element).recursivelyCollect('previousSibling');
1227   - },
1228   -
1229   - nextSiblings: function(element) {
1230   - return $(element).recursivelyCollect('nextSibling');
1231   - },
1232   -
1233   - siblings: function(element) {
1234   - element = $(element);
1235   - return element.previousSiblings().reverse().concat(element.nextSiblings());
1236   - },
1237   -
1238   - match: function(element, selector) {
1239   - if (typeof selector == 'string')
1240   - selector = new Selector(selector);
1241   - return selector.match($(element));
1242   - },
1243   -
1244   - up: function(element, expression, index) {
1245   - return Selector.findElement($(element).ancestors(), expression, index);
1246   - },
1247   -
1248   - down: function(element, expression, index) {
1249   - return Selector.findElement($(element).descendants(), expression, index);
1250   - },
1251   -
1252   - previous: function(element, expression, index) {
1253   - return Selector.findElement($(element).previousSiblings(), expression, index);
1254   - },
1255   -
1256   - next: function(element, expression, index) {
1257   - return Selector.findElement($(element).nextSiblings(), expression, index);
1258   - },
1259   -
1260   - getElementsBySelector: function() {
1261   - var args = $A(arguments), element = $(args.shift());
1262   - return Selector.findChildElements(element, args);
1263   - },
1264   -
1265   - getElementsByClassName: function(element, className) {
1266   - return document.getElementsByClassName(className, element);
1267   - },
1268   -
1269   - readAttribute: function(element, name) {
1270   - element = $(element);
1271   - if (document.all && !window.opera) {
1272   - var t = Element._attributeTranslations;
1273   - if (t.values[name]) return t.values[name](element, name);
1274   - if (t.names[name]) name = t.names[name];
1275   - var attribute = element.attributes[name];
1276   - if(attribute) return attribute.nodeValue;
1277   - }
1278   - return element.getAttribute(name);
1279   - },
1280   -
1281   - getHeight: function(element) {
1282   - return $(element).getDimensions().height;
1283   - },
1284   -
1285   - getWidth: function(element) {
1286   - return $(element).getDimensions().width;
1287   - },
1288   -
1289   - classNames: function(element) {
1290   - return new Element.ClassNames(element);
1291   - },
1292   -
1293   - hasClassName: function(element, className) {
1294   - if (!(element = $(element))) return;
1295   - var elementClassName = element.className;
1296   - if (elementClassName.length == 0) return false;
1297   - if (elementClassName == className ||
1298   - elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
1299   - return true;
1300   - return false;
1301   - },
1302   -
1303   - addClassName: function(element, className) {
1304   - if (!(element = $(element))) return;
1305   - Element.classNames(element).add(className);
1306   - return element;
1307   - },
1308   -
1309   - removeClassName: function(element, className) {
1310   - if (!(element = $(element))) return;
1311   - Element.classNames(element).remove(className);
1312   - return element;
1313   - },
1314   -
1315   - toggleClassName: function(element, className) {
1316   - if (!(element = $(element))) return;
1317   - Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
1318   - return element;
1319   - },
1320   -
1321   - observe: function() {
1322   - Event.observe.apply(Event, arguments);
1323   - return $A(arguments).first();
1324   - },
1325   -
1326   - stopObserving: function() {
1327   - Event.stopObserving.apply(Event, arguments);
1328   - return $A(arguments).first();
1329   - },
1330   -
1331   - // removes whitespace-only text node children
1332   - cleanWhitespace: function(element) {
1333   - element = $(element);
1334   - var node = element.firstChild;
1335   - while (node) {
1336   - var nextNode = node.nextSibling;
1337   - if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
1338   - element.removeChild(node);
1339   - node = nextNode;
1340   - }
1341   - return element;
1342   - },
1343   -
1344   - empty: function(element) {
1345   - return $(element).innerHTML.match(/^\s*$/);
1346   - },
1347   -
1348   - descendantOf: function(element, ancestor) {
1349   - element = $(element), ancestor = $(ancestor);
1350   - while (element = element.parentNode)
1351   - if (element == ancestor) return true;
1352   - return false;
1353   - },
1354   -
1355   - scrollTo: function(element) {
1356   - element = $(element);
1357   - var pos = Position.cumulativeOffset(element);
1358   - window.scrollTo(pos[0], pos[1]);
1359   - return element;
1360   - },
1361   -
1362   - getStyle: function(element, style) {
1363   - element = $(element);
1364   - if (['float','cssFloat'].include(style))
1365   - style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
1366   - style = style.camelize();
1367   - var value = element.style[style];
1368   - if (!value) {
1369   - if (document.defaultView && document.defaultView.getComputedStyle) {
1370   - var css = document.defaultView.getComputedStyle(element, null);
1371   - value = css ? css[style] : null;
1372   - } else if (element.currentStyle) {
1373   - value = element.currentStyle[style];
1374   - }
1375   - }
1376   -
1377   - if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
1378   - value = element['offset'+style.capitalize()] + 'px';
1379   -
1380   - if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
1381   - if (Element.getStyle(element, 'position') == 'static') value = 'auto';
1382   - if(style == 'opacity') {
1383   - if(value) return parseFloat(value);
1384   - if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
1385   - if(value[1]) return parseFloat(value[1]) / 100;
1386   - return 1.0;
1387   - }
1388   - return value == 'auto' ? null : value;
1389   - },
1390   -
1391   - setStyle: function(element, style) {
1392   - element = $(element);
1393   - for (var name in style) {
1394   - var value = style[name];
1395   - if(name == 'opacity') {
1396   - if (value == 1) {
1397   - value = (/Gecko/.test(navigator.userAgent) &&
1398   - !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
1399   - if(/MSIE/.test(navigator.userAgent) && !window.opera)
1400   - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
1401   - } else if(value === '') {
1402   - if(/MSIE/.test(navigator.userAgent) && !window.opera)
1403   - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
1404   - } else {
1405   - if(value < 0.00001) value = 0;
1406   - if(/MSIE/.test(navigator.userAgent) && !window.opera)
1407   - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
1408   - 'alpha(opacity='+value*100+')';
1409   - }
1410   - } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
1411   - element.style[name.camelize()] = value;
1412   - }
1413   - return element;
1414   - },
1415   -
1416   - getDimensions: function(element) {
1417   - element = $(element);
1418   - var display = $(element).getStyle('display');
1419   - if (display != 'none' && display != null) // Safari bug
1420   - return {width: element.offsetWidth, height: element.offsetHeight};
1421   -
1422   - // All *Width and *Height properties give 0 on elements with display none,
1423   - // so enable the element temporarily
1424   - var els = element.style;
1425   - var originalVisibility = els.visibility;
1426   - var originalPosition = els.position;
1427   - var originalDisplay = els.display;
1428   - els.visibility = 'hidden';
1429   - els.position = 'absolute';
1430   - els.display = 'block';
1431   - var originalWidth = element.clientWidth;
1432   - var originalHeight = element.clientHeight;
1433   - els.display = originalDisplay;
1434   - els.position = originalPosition;
1435   - els.visibility = originalVisibility;
1436   - return {width: originalWidth, height: originalHeight};
1437   - },
1438   -
1439   - makePositioned: function(element) {
1440   - element = $(element);
1441   - var pos = Element.getStyle(element, 'position');
1442   - if (pos == 'static' || !pos) {
1443   - element._madePositioned = true;
1444   - element.style.position = 'relative';
1445   - // Opera returns the offset relative to the positioning context, when an
1446   - // element is position relative but top and left have not been defined
1447   - if (window.opera) {
1448   - element.style.top = 0;
1449   - element.style.left = 0;
1450   - }
1451   - }
1452   - return element;
1453   - },
1454   -
1455   - undoPositioned: function(element) {
1456   - element = $(element);
1457   - if (element._madePositioned) {
1458   - element._madePositioned = undefined;
1459   - element.style.position =
1460   - element.style.top =
1461   - element.style.left =
1462   - element.style.bottom =
1463   - element.style.right = '';
1464   - }
1465   - return element;
1466   - },
1467   -
1468   - makeClipping: function(element) {
1469   - element = $(element);
1470   - if (element._overflow) return element;
1471   - element._overflow = element.style.overflow || 'auto';
1472   - if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
1473   - element.style.overflow = 'hidden';
1474   - return element;
1475   - },
1476   -
1477   - undoClipping: function(element) {
1478   - element = $(element);
1479   - if (!element._overflow) return element;
1480   - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
1481   - element._overflow = null;
1482   - return element;
1483   - }
1484   -};
1485   -
1486   -Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf});
1487   -
1488   -Element._attributeTranslations = {};
1489   -
1490   -Element._attributeTranslations.names = {
1491   - colspan: "colSpan",
1492   - rowspan: "rowSpan",
1493   - valign: "vAlign",
1494   - datetime: "dateTime",
1495   - accesskey: "accessKey",
1496   - tabindex: "tabIndex",
1497   - enctype: "encType",
1498   - maxlength: "maxLength",
1499   - readonly: "readOnly",
1500   - longdesc: "longDesc"
1501   -};
1502   -
1503   -Element._attributeTranslations.values = {
1504   - _getAttr: function(element, attribute) {
1505   - return element.getAttribute(attribute, 2);
1506   - },
1507   -
1508   - _flag: function(element, attribute) {
1509   - return $(element).hasAttribute(attribute) ? attribute : null;
1510   - },
1511   -
1512   - style: function(element) {
1513   - return element.style.cssText.toLowerCase();
1514   - },
1515   -
1516   - title: function(element) {
1517   - var node = element.getAttributeNode('title');
1518   - return node.specified ? node.nodeValue : null;
1519   - }
1520   -};
1521   -
1522   -Object.extend(Element._attributeTranslations.values, {
1523   - href: Element._attributeTranslations.values._getAttr,
1524   - src: Element._attributeTranslations.values._getAttr,
1525   - disabled: Element._attributeTranslations.values._flag,
1526   - checked: Element._attributeTranslations.values._flag,
1527   - readonly: Element._attributeTranslations.values._flag,
1528   - multiple: Element._attributeTranslations.values._flag
1529   -});
1530   -
1531   -Element.Methods.Simulated = {
1532   - hasAttribute: function(element, attribute) {
1533   - var t = Element._attributeTranslations;
1534   - attribute = t.names[attribute] || attribute;
1535   - return $(element).getAttributeNode(attribute).specified;
1536   - }
1537   -};
1538   -
1539   -// IE is missing .innerHTML support for TABLE-related elements
1540   -if (document.all && !window.opera){
1541   - Element.Methods.update = function(element, html) {
1542   - element = $(element);
1543   - html = typeof html == 'undefined' ? '' : html.toString();
1544   - var tagName = element.tagName.toUpperCase();
1545   - if (['THEAD','TBODY','TR','TD'].include(tagName)) {
1546   - var div = document.createElement('div');
1547   - switch (tagName) {
1548   - case 'THEAD':
1549   - case 'TBODY':
1550   - div.innerHTML = '<table><tbody>' + html.stripScripts() + '</tbody></table>';
1551   - depth = 2;
1552   - break;
1553   - case 'TR':
1554   - div.innerHTML = '<table><tbody><tr>' + html.stripScripts() + '</tr></tbody></table>';
1555   - depth = 3;
1556   - break;
1557   - case 'TD':
1558   - div.innerHTML = '<table><tbody><tr><td>' + html.stripScripts() + '</td></tr></tbody></table>';
1559   - depth = 4;
1560   - }
1561   - $A(element.childNodes).each(function(node){
1562   - element.removeChild(node)
1563   - });
1564   - depth.times(function(){ div = div.firstChild });
1565   -
1566   - $A(div.childNodes).each(
1567   - function(node){ element.appendChild(node) });
1568   - } else {
1569   - element.innerHTML = html.stripScripts();
1570   - }
1571   - setTimeout(function() {html.evalScripts()}, 10);
1572   - return element;
1573   - }
1574   -};
1575   -
1576   -Object.extend(Element, Element.Methods);
1577   -
1578   -var _nativeExtensions = false;
1579   -
1580   -if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
1581   - ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
1582   - var className = 'HTML' + tag + 'Element';
1583   - if(window[className]) return;
1584   - var klass = window[className] = {};
1585   - klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
1586   - });
1587   -
1588   -Element.addMethods = function(methods) {
1589   - Object.extend(Element.Methods, methods || {});
1590   -
1591   - function copy(methods, destination, onlyIfAbsent) {
1592   - onlyIfAbsent = onlyIfAbsent || false;
1593   - var cache = Element.extend.cache;
1594   - for (var property in methods) {
1595   - var value = methods[property];
1596   - if (!onlyIfAbsent || !(property in destination))
1597   - destination[property] = cache.findOrStore(value);
1598   - }
1599   - }
1600   -
1601   - if (typeof HTMLElement != 'undefined') {
1602   - copy(Element.Methods, HTMLElement.prototype);
1603   - copy(Element.Methods.Simulated, HTMLElement.prototype, true);
1604   - copy(Form.Methods, HTMLFormElement.prototype);
1605   - [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
1606   - copy(Form.Element.Methods, klass.prototype);
1607   - });
1608   - _nativeExtensions = true;
1609   - }
1610   -}
1611   -
1612   -var Toggle = new Object();
1613   -Toggle.display = Element.toggle;
1614   -
1615   -/*--------------------------------------------------------------------------*/
1616   -
1617   -Abstract.Insertion = function(adjacency) {
1618   - this.adjacency = adjacency;
1619   -}
1620   -
1621   -Abstract.Insertion.prototype = {
1622   - initialize: function(element, content) {
1623   - this.element = $(element);
1624   - this.content = content.stripScripts();
1625   -
1626   - if (this.adjacency && this.element.insertAdjacentHTML) {
1627   - try {
1628   - this.element.insertAdjacentHTML(this.adjacency, this.content);
1629   - } catch (e) {
1630   - var tagName = this.element.tagName.toUpperCase();
1631   - if (['TBODY', 'TR'].include(tagName)) {
1632   - this.insertContent(this.contentFromAnonymousTable());
1633   - } else {
1634   - throw e;
1635   - }
1636   - }
1637   - } else {
1638   - this.range = this.element.ownerDocument.createRange();
1639   - if (this.initializeRange) this.initializeRange();
1640   - this.insertContent([this.range.createContextualFragment(this.content)]);
1641   - }
1642   -
1643   - setTimeout(function() {content.evalScripts()}, 10);
1644   - },
1645   -
1646   - contentFromAnonymousTable: function() {
1647   - var div = document.createElement('div');
1648   - div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
1649   - return $A(div.childNodes[0].childNodes[0].childNodes);
1650   - }
1651   -}
1652   -
1653   -var Insertion = new Object();
1654   -
1655   -Insertion.Before = Class.create();
1656   -Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
1657   - initializeRange: function() {
1658   - this.range.setStartBefore(this.element);
1659   - },
1660   -
1661   - insertContent: function(fragments) {
1662   - fragments.each((function(fragment) {
1663   - this.element.parentNode.insertBefore(fragment, this.element);
1664   - }).bind(this));
1665   - }
1666   -});
1667   -
1668   -Insertion.Top = Class.create();
1669   -Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
1670   - initializeRange: function() {
1671   - this.range.selectNodeContents(this.element);
1672   - this.range.collapse(true);
1673   - },
1674   -
1675   - insertContent: function(fragments) {
1676   - fragments.reverse(false).each((function(fragment) {
1677   - this.element.insertBefore(fragment, this.element.firstChild);
1678   - }).bind(this));
1679   - }
1680   -});
1681   -
1682   -Insertion.Bottom = Class.create();
1683   -Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
1684   - initializeRange: function() {
1685   - this.range.selectNodeContents(this.element);
1686   - this.range.collapse(this.element);
1687   - },
1688   -
1689   - insertContent: function(fragments) {
1690   - fragments.each((function(fragment) {
1691   - this.element.appendChild(fragment);
1692   - }).bind(this));
1693   - }
1694   -});
1695   -
1696   -Insertion.After = Class.create();
1697   -Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
1698   - initializeRange: function() {
1699   - this.range.setStartAfter(this.element);
1700   - },
1701   -
1702   - insertContent: function(fragments) {
1703   - fragments.each((function(fragment) {
1704   - this.element.parentNode.insertBefore(fragment,
1705   - this.element.nextSibling);
1706   - }).bind(this));
1707   - }
1708   -});
1709   -
1710   -/*--------------------------------------------------------------------------*/
1711   -
1712   -Element.ClassNames = Class.create();
1713   -Element.ClassNames.prototype = {
1714   - initialize: function(element) {
1715   - this.element = $(element);
1716   - },
1717   -
1718   - _each: function(iterator) {
1719   - this.element.className.split(/\s+/).select(function(name) {
1720   - return name.length > 0;
1721   - })._each(iterator);
1722   - },
1723   -
1724   - set: function(className) {
1725   - this.element.className = className;
1726   - },
1727   -
1728   - add: function(classNameToAdd) {
1729   - if (this.include(classNameToAdd)) return;
1730   - this.set($A(this).concat(classNameToAdd).join(' '));
1731   - },
1732   -
1733   - remove: function(classNameToRemove) {
1734   - if (!this.include(classNameToRemove)) return;
1735   - this.set($A(this).without(classNameToRemove).join(' '));
1736   - },
1737   -
1738   - toString: function() {
1739   - return $A(this).join(' ');
1740   - }
1741   -};
1742   -
1743   -Object.extend(Element.ClassNames.prototype, Enumerable);
1744   -var Selector = Class.create();
1745   -Selector.prototype = {
1746   - initialize: function(expression) {
1747   - this.params = {classNames: []};
1748   - this.expression = expression.toString().strip();
1749   - this.parseExpression();
1750   - this.compileMatcher();
1751   - },
1752   -
1753   - parseExpression: function() {
1754   - function abort(message) { throw 'Parse error in selector: ' + message; }
1755   -
1756   - if (this.expression == '') abort('empty expression');
1757   -
1758   - var params = this.params, expr = this.expression, match, modifier, clause, rest;
1759   - while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
1760   - params.attributes = params.attributes || [];
1761   - params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
1762   - expr = match[1];
1763   - }
1764   -
1765   - if (expr == '*') return this.params.wildcard = true;
1766   -
1767   - while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
1768   - modifier = match[1], clause = match[2], rest = match[3];
1769   - switch (modifier) {
1770   - case '#': params.id = clause; break;
1771   - case '.': params.classNames.push(clause); break;
1772   - case '':
1773   - case undefined: params.tagName = clause.toUpperCase(); break;
1774   - default: abort(expr.inspect());
1775   - }
1776   - expr = rest;
1777   - }
1778   -
1779   - if (expr.length > 0) abort(expr.inspect());
1780   - },
1781   -
1782   - buildMatchExpression: function() {
1783   - var params = this.params, conditions = [], clause;
1784   -
1785   - if (params.wildcard)
1786   - conditions.push('true');
1787   - if (clause = params.id)
1788   - conditions.push('element.readAttribute("id") == ' + clause.inspect());
1789   - if (clause = params.tagName)
1790   - conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
1791   - if ((clause = params.classNames).length > 0)
1792   - for (var i = 0, length = clause.length; i < length; i++)
1793   - conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
1794   - if (clause = params.attributes) {
1795   - clause.each(function(attribute) {
1796   - var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
1797   - var splitValueBy = function(delimiter) {
1798   - return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
1799   - }
1800   -
1801   - switch (attribute.operator) {
1802   - case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
1803   - case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
1804   - case '|=': conditions.push(
1805   - splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
1806   - ); break;
1807   - case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
1808   - case '':
1809   - case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
1810   - default: throw 'Unknown operator ' + attribute.operator + ' in selector';
1811   - }
1812   - });
1813   - }
1814   -
1815   - return conditions.join(' && ');
1816   - },
1817   -
1818   - compileMatcher: function() {
1819   - this.match = new Function('element', 'if (!element.tagName) return false; \
1820   - element = $(element); \
1821   - return ' + this.buildMatchExpression());
1822   - },
1823   -
1824   - findElements: function(scope) {
1825   - var element;
1826   -
1827   - if (element = $(this.params.id))
1828   - if (this.match(element))
1829   - if (!scope || Element.childOf(element, scope))
1830   - return [element];
1831   -
1832   - scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
1833   -
1834   - var results = [];
1835   - for (var i = 0, length = scope.length; i < length; i++)
1836   - if (this.match(element = scope[i]))
1837   - results.push(Element.extend(element));
1838   -
1839   - return results;
1840   - },
1841   -
1842   - toString: function() {
1843   - return this.expression;
1844   - }
1845   -}
1846   -
1847   -Object.extend(Selector, {
1848   - matchElements: function(elements, expression) {
1849   - var selector = new Selector(expression);
1850   - return elements.select(selector.match.bind(selector)).map(Element.extend);
1851   - },
1852   -
1853   - findElement: function(elements, expression, index) {
1854   - if (typeof expression == 'number') index = expression, expression = false;
1855   - return Selector.matchElements(elements, expression || '*')[index || 0];
1856   - },
1857   -
1858   - findChildElements: function(element, expressions) {
1859   - return expressions.map(function(expression) {
1860   - return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
1861   - var selector = new Selector(expr);
1862   - return results.inject([], function(elements, result) {
1863   - return elements.concat(selector.findElements(result || element));
1864   - });
1865   - });
1866   - }).flatten();
1867   - }
1868   -});
1869   -
1870   -function $$() {
1871   - return Selector.findChildElements(document, $A(arguments));
1872   -}
1873   -var Form = {
1874   - reset: function(form) {
1875   - $(form).reset();
1876   - return form;
1877   - },
1878   -
1879   - serializeElements: function(elements, getHash) {
1880   - var data = elements.inject({}, function(result, element) {
1881   - if (!element.disabled && element.name) {
1882   - var key = element.name, value = $(element).getValue();
1883   - if (value != undefined) {
1884   - if (result[key]) {
1885   - if (result[key].constructor != Array) result[key] = [result[key]];
1886   - result[key].push(value);
1887   - }
1888   - else result[key] = value;
1889   - }
1890   - }
1891   - return result;
1892   - });
1893   -
1894   - return getHash ? data : Hash.toQueryString(data);
1895   - }
1896   -};
1897   -
1898   -Form.Methods = {
1899   - serialize: function(form, getHash) {
1900   - return Form.serializeElements(Form.getElements(form), getHash);
1901   - },
1902   -
1903   - getElements: function(form) {
1904   - return $A($(form).getElementsByTagName('*')).inject([],
1905   - function(elements, child) {
1906   - if (Form.Element.Serializers[child.tagName.toLowerCase()])
1907   - elements.push(Element.extend(child));
1908   - return elements;
1909   - }
1910   - );
1911   - },
1912   -
1913   - getInputs: function(form, typeName, name) {
1914   - form = $(form);
1915   - var inputs = form.getElementsByTagName('input');
1916   -
1917   - if (!typeName && !name) return $A(inputs).map(Element.extend);
1918   -
1919   - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
1920   - var input = inputs[i];
1921   - if ((typeName && input.type != typeName) || (name && input.name != name))
1922   - continue;
1923   - matchingInputs.push(Element.extend(input));
1924   - }
1925   -
1926   - return matchingInputs;
1927   - },
1928   -
1929   - disable: function(form) {
1930   - form = $(form);
1931   - form.getElements().each(function(element) {
1932   - element.blur();
1933   - element.disabled = 'true';
1934   - });
1935   - return form;
1936   - },
1937   -
1938   - enable: function(form) {
1939   - form = $(form);
1940   - form.getElements().each(function(element) {
1941   - element.disabled = '';
1942   - });
1943   - return form;
1944   - },
1945   -
1946   - findFirstElement: function(form) {
1947   - return $(form).getElements().find(function(element) {
1948   - return element.type != 'hidden' && !element.disabled &&
1949   - ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
1950   - });
1951   - },
1952   -
1953   - focusFirstElement: function(form) {
1954   - form = $(form);
1955   - form.findFirstElement().activate();
1956   - return form;
1957   - }
1958   -}
1959   -
1960   -Object.extend(Form, Form.Methods);
1961   -
1962   -/*--------------------------------------------------------------------------*/
1963   -
1964   -Form.Element = {
1965   - focus: function(element) {
1966   - $(element).focus();
1967   - return element;
1968   - },
1969   -
1970   - select: function(element) {
1971   - $(element).select();
1972   - return element;
1973   - }
1974   -}
1975   -
1976   -Form.Element.Methods = {
1977   - serialize: function(element) {
1978   - element = $(element);
1979   - if (!element.disabled && element.name) {
1980   - var value = element.getValue();
1981   - if (value != undefined) {
1982   - var pair = {};
1983   - pair[element.name] = value;
1984   - return Hash.toQueryString(pair);
1985   - }
1986   - }
1987   - return '';
1988   - },
1989   -
1990   - getValue: function(element) {
1991   - element = $(element);
1992   - var method = element.tagName.toLowerCase();
1993   - return Form.Element.Serializers[method](element);
1994   - },
1995   -
1996   - clear: function(element) {
1997   - $(element).value = '';
1998   - return element;
1999   - },
2000   -
2001   - present: function(element) {
2002   - return $(element).value != '';
2003   - },
2004   -
2005   - activate: function(element) {
2006   - element = $(element);
2007   - element.focus();
2008   - if (element.select && ( element.tagName.toLowerCase() != 'input' ||
2009   - !['button', 'reset', 'submit'].include(element.type) ) )
2010   - element.select();
2011   - return element;
2012   - },
2013   -
2014   - disable: function(element) {
2015   - element = $(element);
2016   - element.disabled = true;
2017   - return element;
2018   - },
2019   -
2020   - enable: function(element) {
2021   - element = $(element);
2022   - element.blur();
2023   - element.disabled = false;
2024   - return element;
2025   - }
2026   -}
2027   -
2028   -Object.extend(Form.Element, Form.Element.Methods);
2029   -var Field = Form.Element;
2030   -var $F = Form.Element.getValue;
2031   -
2032   -/*--------------------------------------------------------------------------*/
2033   -
2034   -Form.Element.Serializers = {
2035   - input: function(element) {
2036   - switch (element.type.toLowerCase()) {
2037   - case 'checkbox':
2038   - case 'radio':
2039   - return Form.Element.Serializers.inputSelector(element);
2040   - default:
2041   - return Form.Element.Serializers.textarea(element);
2042   - }
2043   - },
2044   -
2045   - inputSelector: function(element) {
2046   - return element.checked ? element.value : null;
2047   - },
2048   -
2049   - textarea: function(element) {
2050   - return element.value;
2051   - },
2052   -
2053   - select: function(element) {
2054   - return this[element.type == 'select-one' ?
2055   - 'selectOne' : 'selectMany'](element);
2056   - },
2057   -
2058   - selectOne: function(element) {
2059   - var index = element.selectedIndex;
2060   - return index >= 0 ? this.optionValue(element.options[index]) : null;
2061   - },
2062   -
2063   - selectMany: function(element) {
2064   - var values, length = element.length;
2065   - if (!length) return null;
2066   -
2067   - for (var i = 0, values = []; i < length; i++) {
2068   - var opt = element.options[i];
2069   - if (opt.selected) values.push(this.optionValue(opt));
2070   - }
2071   - return values;
2072   - },
2073   -
2074   - optionValue: function(opt) {
2075   - // extend element because hasAttribute may not be native
2076   - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
2077   - }
2078   -}
2079   -
2080   -/*--------------------------------------------------------------------------*/
2081   -
2082   -Abstract.TimedObserver = function() {}
2083   -Abstract.TimedObserver.prototype = {
2084   - initialize: function(element, frequency, callback) {
2085   - this.frequency = frequency;
2086   - this.element = $(element);
2087   - this.callback = callback;
2088   -
2089   - this.lastValue = this.getValue();
2090   - this.registerCallback();
2091   - },
2092   -
2093   - registerCallback: function() {
2094   - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
2095   - },
2096   -
2097   - onTimerEvent: function() {
2098   - var value = this.getValue();
2099   - var changed = ('string' == typeof this.lastValue && 'string' == typeof value
2100   - ? this.lastValue != value : String(this.lastValue) != String(value));
2101   - if (changed) {
2102   - this.callback(this.element, value);
2103   - this.lastValue = value;
2104   - }
2105   - }
2106   -}
2107   -
2108   -Form.Element.Observer = Class.create();
2109   -Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
2110   - getValue: function() {
2111   - return Form.Element.getValue(this.element);
2112   - }
2113   -});
2114   -
2115   -Form.Observer = Class.create();
2116   -Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
2117   - getValue: function() {
2118   - return Form.serialize(this.element);
2119   - }
2120   -});
2121   -
2122   -/*--------------------------------------------------------------------------*/
2123   -
2124   -Abstract.EventObserver = function() {}
2125   -Abstract.EventObserver.prototype = {
2126   - initialize: function(element, callback) {
2127   - this.element = $(element);
2128   - this.callback = callback;
2129   -
2130   - this.lastValue = this.getValue();
2131   - if (this.element.tagName.toLowerCase() == 'form')
2132   - this.registerFormCallbacks();
2133   - else
2134   - this.registerCallback(this.element);
2135   - },
2136   -
2137   - onElementEvent: function() {
2138   - var value = this.getValue();
2139   - if (this.lastValue != value) {
2140   - this.callback(this.element, value);
2141   - this.lastValue = value;
2142   - }
2143   - },
2144   -
2145   - registerFormCallbacks: function() {
2146   - Form.getElements(this.element).each(this.registerCallback.bind(this));
2147   - },
2148   -
2149   - registerCallback: function(element) {
2150   - if (element.type) {
2151   - switch (element.type.toLowerCase()) {
2152   - case 'checkbox':
2153   - case 'radio':
2154   - Event.observe(element, 'click', this.onElementEvent.bind(this));
2155   - break;
2156   - default:
2157   - Event.observe(element, 'change', this.onElementEvent.bind(this));
2158   - break;
2159   - }
2160   - }
2161   - }
2162   -}
2163   -
2164   -Form.Element.EventObserver = Class.create();
2165   -Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
2166   - getValue: function() {
2167   - return Form.Element.getValue(this.element);
2168   - }
2169   -});
2170   -
2171   -Form.EventObserver = Class.create();
2172   -Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
2173   - getValue: function() {
2174   - return Form.serialize(this.element);
2175   - }
2176   -});
2177   -if (!window.Event) {
2178   - var Event = new Object();
2179   -}
2180   -
2181   -Object.extend(Event, {
2182   - KEY_BACKSPACE: 8,
2183   - KEY_TAB: 9,
2184   - KEY_RETURN: 13,
2185   - KEY_ESC: 27,
2186   - KEY_LEFT: 37,
2187   - KEY_UP: 38,
2188   - KEY_RIGHT: 39,
2189   - KEY_DOWN: 40,
2190   - KEY_DELETE: 46,
2191   - KEY_HOME: 36,
2192   - KEY_END: 35,
2193   - KEY_PAGEUP: 33,
2194   - KEY_PAGEDOWN: 34,
2195   -
2196   - element: function(event) {
2197   - return event.target || event.srcElement;
2198   - },
2199   -
2200   - isLeftClick: function(event) {
2201   - return (((event.which) && (event.which == 1)) ||
2202   - ((event.button) && (event.button == 1)));
2203   - },
2204   -
2205   - pointerX: function(event) {
2206   - return event.pageX || (event.clientX +
2207   - (document.documentElement.scrollLeft || document.body.scrollLeft));
2208   - },
2209   -
2210   - pointerY: function(event) {
2211   - return event.pageY || (event.clientY +
2212   - (document.documentElement.scrollTop || document.body.scrollTop));
2213   - },
2214   -
2215   - stop: function(event) {
2216   - if (event.preventDefault) {
2217   - event.preventDefault();
2218   - event.stopPropagation();
2219   - } else {
2220   - event.returnValue = false;
2221   - event.cancelBubble = true;
2222   - }
2223   - },
2224   -
2225   - // find the first node with the given tagName, starting from the
2226   - // node the event was triggered on; traverses the DOM upwards
2227   - findElement: function(event, tagName) {
2228   - var element = Event.element(event);
2229   - while (element.parentNode && (!element.tagName ||
2230   - (element.tagName.toUpperCase() != tagName.toUpperCase())))
2231   - element = element.parentNode;
2232   - return element;
2233   - },
2234   -
2235   - observers: false,
2236   -
2237   - _observeAndCache: function(element, name, observer, useCapture) {
2238   - if (!this.observers) this.observers = [];
2239   - if (element.addEventListener) {
2240   - this.observers.push([element, name, observer, useCapture]);
2241   - element.addEventListener(name, observer, useCapture);
2242   - } else if (element.attachEvent) {
2243   - this.observers.push([element, name, observer, useCapture]);
2244   - element.attachEvent('on' + name, observer);
2245   - }
2246   - },
2247   -
2248   - unloadCache: function() {
2249   - if (!Event.observers) return;
2250   - for (var i = 0, length = Event.observers.length; i < length; i++) {
2251   - Event.stopObserving.apply(this, Event.observers[i]);
2252   - Event.observers[i][0] = null;
2253   - }
2254   - Event.observers = false;
2255   - },
2256   -
2257   - observe: function(element, name, observer, useCapture) {
2258   - element = $(element);
2259   - useCapture = useCapture || false;
2260   -
2261   - if (name == 'keypress' &&
2262   - (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
2263   - || element.attachEvent))
2264   - name = 'keydown';
2265   -
2266   - Event._observeAndCache(element, name, observer, useCapture);
2267   - },
2268   -
2269   - stopObserving: function(element, name, observer, useCapture) {
2270   - element = $(element);
2271   - useCapture = useCapture || false;
2272   -
2273   - if (name == 'keypress' &&
2274   - (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
2275   - || element.detachEvent))
2276   - name = 'keydown';
2277   -
2278   - if (element.removeEventListener) {
2279   - element.removeEventListener(name, observer, useCapture);
2280   - } else if (element.detachEvent) {
2281   - try {
2282   - element.detachEvent('on' + name, observer);
2283   - } catch (e) {}
2284   - }
2285   - }
2286   -});
2287   -
2288   -/* prevent memory leaks in IE */
2289   -if (navigator.appVersion.match(/\bMSIE\b/))
2290   - Event.observe(window, 'unload', Event.unloadCache, false);
2291   -var Position = {
2292   - // set to true if needed, warning: firefox performance problems
2293   - // NOT neeeded for page scrolling, only if draggable contained in
2294   - // scrollable elements
2295   - includeScrollOffsets: false,
2296   -
2297   - // must be called before calling withinIncludingScrolloffset, every time the
2298   - // page is scrolled
2299   - prepare: function() {
2300   - this.deltaX = window.pageXOffset
2301   - || document.documentElement.scrollLeft
2302   - || document.body.scrollLeft
2303   - || 0;
2304   - this.deltaY = window.pageYOffset
2305   - || document.documentElement.scrollTop
2306   - || document.body.scrollTop
2307   - || 0;
2308   - },
2309   -
2310   - realOffset: function(element) {
2311   - var valueT = 0, valueL = 0;
2312   - do {
2313   - valueT += element.scrollTop || 0;
2314   - valueL += element.scrollLeft || 0;
2315   - element = element.parentNode;
2316   - } while (element);
2317   - return [valueL, valueT];
2318   - },
2319   -
2320   - cumulativeOffset: function(element) {
2321   - var valueT = 0, valueL = 0;
2322   - do {
2323   - valueT += element.offsetTop || 0;
2324   - valueL += element.offsetLeft || 0;
2325   - element = element.offsetParent;
2326   - } while (element);
2327   - return [valueL, valueT];
2328   - },
2329   -
2330   - positionedOffset: function(element) {
2331   - var valueT = 0, valueL = 0;
2332   - do {
2333   - valueT += element.offsetTop || 0;
2334   - valueL += element.offsetLeft || 0;
2335   - element = element.offsetParent;
2336   - if (element) {
2337   - if(element.tagName=='BODY') break;
2338   - var p = Element.getStyle(element, 'position');
2339   - if (p == 'relative' || p == 'absolute') break;
2340   - }
2341   - } while (element);
2342   - return [valueL, valueT];
2343   - },
2344   -
2345   - offsetParent: function(element) {
2346   - if (element.offsetParent) return element.offsetParent;
2347   - if (element == document.body) return element;
2348   -
2349   - while ((element = element.parentNode) && element != document.body)
2350   - if (Element.getStyle(element, 'position') != 'static')
2351   - return element;
2352   -
2353   - return document.body;
2354   - },
2355   -
2356   - // caches x/y coordinate pair to use with overlap
2357   - within: function(element, x, y) {
2358   - if (this.includeScrollOffsets)
2359   - return this.withinIncludingScrolloffsets(element, x, y);
2360   - this.xcomp = x;
2361   - this.ycomp = y;
2362   - this.offset = this.cumulativeOffset(element);
2363   -
2364   - return (y >= this.offset[1] &&
2365   - y < this.offset[1] + element.offsetHeight &&
2366   - x >= this.offset[0] &&
2367   - x < this.offset[0] + element.offsetWidth);
2368   - },
2369   -
2370   - withinIncludingScrolloffsets: function(element, x, y) {
2371   - var offsetcache = this.realOffset(element);
2372   -
2373   - this.xcomp = x + offsetcache[0] - this.deltaX;
2374   - this.ycomp = y + offsetcache[1] - this.deltaY;
2375   - this.offset = this.cumulativeOffset(element);
2376   -
2377   - return (this.ycomp >= this.offset[1] &&
2378   - this.ycomp < this.offset[1] + element.offsetHeight &&
2379   - this.xcomp >= this.offset[0] &&
2380   - this.xcomp < this.offset[0] + element.offsetWidth);
2381   - },
2382   -
2383   - // within must be called directly before
2384   - overlap: function(mode, element) {
2385   - if (!mode) return 0;
2386   - if (mode == 'vertical')
2387   - return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
2388   - element.offsetHeight;
2389   - if (mode == 'horizontal')
2390   - return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
2391   - element.offsetWidth;
2392   - },
2393   -
2394   - page: function(forElement) {
2395   - var valueT = 0, valueL = 0;
2396   -
2397   - var element = forElement;
2398   - do {
2399   - valueT += element.offsetTop || 0;
2400   - valueL += element.offsetLeft || 0;
2401   -
2402   - // Safari fix
2403   - if (element.offsetParent==document.body)
2404   - if (Element.getStyle(element,'position')=='absolute') break;
2405   -
2406   - } while (element = element.offsetParent);
2407   -
2408   - element = forElement;
2409   - do {
2410   - if (!window.opera || element.tagName=='BODY') {
2411   - valueT -= element.scrollTop || 0;
2412   - valueL -= element.scrollLeft || 0;
2413   - }
2414   - } while (element = element.parentNode);
2415   -
2416   - return [valueL, valueT];
2417   - },
2418   -
2419   - clone: function(source, target) {
2420   - var options = Object.extend({
2421   - setLeft: true,
2422   - setTop: true,
2423   - setWidth: true,
2424   - setHeight: true,
2425   - offsetTop: 0,
2426   - offsetLeft: 0
2427   - }, arguments[2] || {})
2428   -
2429   - // find page position of source
2430   - source = $(source);
2431   - var p = Position.page(source);
2432   -
2433   - // find coordinate system to use
2434   - target = $(target);
2435   - var delta = [0, 0];
2436   - var parent = null;
2437   - // delta [0,0] will do fine with position: fixed elements,
2438   - // position:absolute needs offsetParent deltas
2439   - if (Element.getStyle(target,'position') == 'absolute') {
2440   - parent = Position.offsetParent(target);
2441   - delta = Position.page(parent);
2442   - }
2443   -
2444   - // correct by body offsets (fixes Safari)
2445   - if (parent == document.body) {
2446   - delta[0] -= document.body.offsetLeft;
2447   - delta[1] -= document.body.offsetTop;
2448   - }
2449   -
2450   - // set position
2451   - if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
2452   - if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
2453   - if(options.setWidth) target.style.width = source.offsetWidth + 'px';
2454   - if(options.setHeight) target.style.height = source.offsetHeight + 'px';
2455   - },
2456   -
2457   - absolutize: function(element) {
2458   - element = $(element);
2459   - if (element.style.position == 'absolute') return;
2460   - Position.prepare();
2461   -
2462   - var offsets = Position.positionedOffset(element);
2463   - var top = offsets[1];
2464   - var left = offsets[0];
2465   - var width = element.clientWidth;
2466   - var height = element.clientHeight;
2467   -
2468   - element._originalLeft = left - parseFloat(element.style.left || 0);
2469   - element._originalTop = top - parseFloat(element.style.top || 0);
2470   - element._originalWidth = element.style.width;
2471   - element._originalHeight = element.style.height;
2472   -
2473   - element.style.position = 'absolute';
2474   - element.style.top = top + 'px';
2475   - element.style.left = left + 'px';
2476   - element.style.width = width + 'px';
2477   - element.style.height = height + 'px';
2478   - },
2479   -
2480   - relativize: function(element) {
2481   - element = $(element);
2482   - if (element.style.position == 'relative') return;
2483   - Position.prepare();
2484   -
2485   - element.style.position = 'relative';
2486   - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
2487   - var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
2488   -
2489   - element.style.top = top + 'px';
2490   - element.style.left = left + 'px';
2491   - element.style.height = element._originalHeight;
2492   - element.style.width = element._originalWidth;
2493   - }
2494   -}
2495   -
2496   -// Safari returns margins on body which is incorrect if the child is absolutely
2497   -// positioned. For performance reasons, redefine Position.cumulativeOffset for
2498   -// KHTML/WebKit only.
2499   -if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
2500   - Position.cumulativeOffset = function(element) {
2501   - var valueT = 0, valueL = 0;
2502   - do {
2503   - valueT += element.offsetTop || 0;
2504   - valueL += element.offsetLeft || 0;
2505   - if (element.offsetParent == document.body)
2506   - if (Element.getStyle(element, 'position') == 'absolute') break;
2507   -
2508   - element = element.offsetParent;
2509   - } while (element);
2510   -
2511   - return [valueL, valueT];
2512   - }
2513   -}
2514   -
2515   -Element.addMethods();
2516 0 \ No newline at end of file
ieducar/intranet/scripts/scriptaculous/scriptaculous.js
... ... @@ -1,51 +0,0 @@
1   -// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
2   -
3   -// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4   -//
5   -// Permission is hereby granted, free of charge, to any person obtaining
6   -// a copy of this software and associated documentation files (the
7   -// "Software"), to deal in the Software without restriction, including
8   -// without limitation the rights to use, copy, modify, merge, publish,
9   -// distribute, sublicense, and/or sell copies of the Software, and to
10   -// permit persons to whom the Software is furnished to do so, subject to
11   -// the following conditions:
12   -//
13   -// The above copyright notice and this permission notice shall be
14   -// included in all copies or substantial portions of the Software.
15   -//
16   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17   -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18   -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19   -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20   -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21   -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22   -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23   -//
24   -// For details, see the script.aculo.us web site: http://script.aculo.us/
25   -
26   -var Scriptaculous = {
27   - Version: '1.7.0',
28   - require: function(libraryName) {
29   - // inserting via DOM fails in Safari 2.0, so brute force approach
30   - document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
31   - },
32   - load: function() {
33   - if((typeof Prototype=='undefined') ||
34   - (typeof Element == 'undefined') ||
35   - (typeof Element.Methods=='undefined') ||
36   - parseFloat(Prototype.Version.split(".")[0] + "." +
37   - Prototype.Version.split(".")[1]) < 1.5)
38   - throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
39   -
40   - $A(document.getElementsByTagName("script")).findAll( function(s) {
41   - return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
42   - }).each( function(s) {
43   - var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
44   - var includes = s.src.match(/\?.*load=([a-z,]*)/);
45   - (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
46   - function(include) { Scriptaculous.require(path+include+'.js') });
47   - });
48   - }
49   -}
50   -
51   -Scriptaculous.load();
52 0 \ No newline at end of file
ieducar/misc/database/deltas/portabilis/25_modulo_alimentacao.txt
... ... @@ -1,315 +0,0 @@
1   --- Schema: "alimentacao"
2   --- DROP SCHEMA alimentacao;
3   -CREATE SCHEMA alimentacao
4   - AUTHORIZATION portabilis;
5   -GRANT ALL ON SCHEMA alimentacao TO portabilis;
6   -
7   --- Sequence: alimentacao.cardapio_idcar_seq
8   --- DROP SEQUENCE alimentacao.cardapio_idcar_seq;
9   -CREATE SEQUENCE alimentacao.cardapio_idcar_seq
10   - INCREMENT 1
11   - MINVALUE 1
12   - MAXVALUE 9223372036854775807
13   - START 1
14   - CACHE 1;
15   -ALTER TABLE alimentacao.cardapio_idcar_seq OWNER TO portabilis;
16   --- Sequence: alimentacao.envio_mensal_padroes_idemp_seq
17   --- DROP SEQUENCE alimentacao.envio_mensal_padroes_idemp_seq;
18   -CREATE SEQUENCE alimentacao.envio_mensal_padroes_idemp_seq
19   - INCREMENT 1
20   - MINVALUE 1
21   - MAXVALUE 9223372036854775807
22   - START 9
23   - CACHE 1;
24   -ALTER TABLE alimentacao.envio_mensal_padroes_idemp_seq OWNER TO portabilis;
25   --- Sequence: alimentacao.envio_mensal_escola_ideme_seq
26   --- DROP SEQUENCE alimentacao.envio_mensal_escola_ideme_seq;
27   -CREATE SEQUENCE alimentacao.envio_mensal_escola_ideme_seq
28   - INCREMENT 1
29   - MINVALUE 1
30   - MAXVALUE 9223372036854775807
31   - START 9
32   - CACHE 1;
33   -ALTER TABLE alimentacao.envio_mensal_escola_ideme_seq OWNER TO portabilis;
34   -
35   --- Sequence: alimentacao.imc_idimc_seq
36   --- DROP SEQUENCE alimentacao.imc_idimc_seq;
37   -CREATE SEQUENCE alimentacao.imc_idimc_seq
38   - INCREMENT 1
39   - MINVALUE 1
40   - MAXVALUE 9223372036854775807
41   - START 8
42   - CACHE 1;
43   -ALTER TABLE alimentacao.imc_idimc_seq OWNER TO portabilis;
44   -
45   --- Sequence: alimentacao.produto_fornecedor_idpf_seq
46   --- DROP SEQUENCE alimentacao.produto_fornecedor_idpf_seq;
47   -CREATE SEQUENCE alimentacao.produto_fornecedor_idpf_seq
48   - INCREMENT 1
49   - MINVALUE 1
50   - MAXVALUE 9223372036854775807
51   - START 7
52   - CACHE 1;
53   -ALTER TABLE alimentacao.produto_fornecedor_idpf_seq OWNER TO portabilis;
54   -
55   --- Sequence: alimentacao.produto_grupo_idpg_seq
56   --- DROP SEQUENCE alimentacao.produto_grupo_idpg_seq;
57   -CREATE SEQUENCE alimentacao.produto_grupo_idpg_seq
58   - INCREMENT 1
59   - MINVALUE 1
60   - MAXVALUE 9223372036854775807
61   - START 3
62   - CACHE 1;
63   -ALTER TABLE alimentacao.produto_grupo_idpg_seq OWNER TO portabilis;
64   --- Sequence: alimentacao.produto_unidade_idpu_seq
65   --- DROP SEQUENCE alimentacao.produto_unidade_idpu_seq;
66   -CREATE SEQUENCE alimentacao.produto_unidade_idpu_seq
67   - INCREMENT 1
68   - MINVALUE 1
69   - MAXVALUE 9223372036854775807
70   - START 3
71   - CACHE 1;
72   -ALTER TABLE alimentacao.produto_unidade_idpu_seq OWNER TO portabilis;
73   --- Sequence: alimentacao.produto_idpro_seq
74   --- DROP SEQUENCE alimentacao.produto_idpro_seq;
75   -CREATE SEQUENCE alimentacao.produto_idpro_seq
76   - INCREMENT 1
77   - MINVALUE 1
78   - MAXVALUE 9223372036854775807
79   - START 1
80   - CACHE 1;
81   -ALTER TABLE alimentacao.produto_idpro_seq OWNER TO portabilis;
82   -
83   --- Table: alimentacao.usuario_escola
84   --- DROP TABLE alimentacao.usuario_escola;
85   -CREATE TABLE alimentacao.usuario_escola
86   -(
87   - ref_usuario integer NOT NULL,
88   - ref_escola integer NOT NULL,
89   - dt_cadastro timestamp without time zone NOT NULL,
90   - CONSTRAINT pk_usuario_escola PRIMARY KEY (ref_usuario, ref_escola),
91   - CONSTRAINT usuario_escola_ref_escola_fkey FOREIGN KEY (ref_escola)
92   - REFERENCES pmieducar.escola (cod_escola) MATCH SIMPLE
93   - ON UPDATE RESTRICT ON DELETE RESTRICT,
94   - CONSTRAINT usuario_escola_ref_usuario_fkey FOREIGN KEY (ref_usuario)
95   - REFERENCES pmieducar.usuario (cod_usuario) MATCH SIMPLE
96   - ON UPDATE RESTRICT ON DELETE RESTRICT
97   -)
98   -WITH OIDS;
99   -ALTER TABLE alimentacao.usuario_escola OWNER TO portabilis;
100   -GRANT ALL ON TABLE alimentacao.usuario_escola TO portabilis;
101   -
102   --- Table: alimentacao.cardapio
103   --- DROP TABLE alimentacao.cardapio;
104   -CREATE TABLE alimentacao.cardapio
105   -(
106   - idcar integer NOT NULL DEFAULT nextval('alimentacao.cardapio_idcar_seq'::regclass),
107   - dt_cadastro timestamp without time zone NOT NULL,
108   - descricao character varying(250),
109   - nm_arquivo character varying(100) NOT NULL,
110   - ref_usuario_cad integer NOT NULL,
111   - ref_escola integer NOT NULL,
112   - path_arquivo character varying(100),
113   - CONSTRAINT pk_cardapio PRIMARY KEY (idcar),
114   - CONSTRAINT cardapio_ref_escola_fkey FOREIGN KEY (ref_escola)
115   - REFERENCES pmieducar.escola (cod_escola) MATCH SIMPLE
116   - ON UPDATE RESTRICT ON DELETE RESTRICT,
117   - CONSTRAINT cardapio_ref_usuario_cad_fkey FOREIGN KEY (ref_usuario_cad)
118   - REFERENCES pmieducar.usuario (cod_usuario) MATCH SIMPLE
119   - ON UPDATE RESTRICT ON DELETE RESTRICT
120   -)
121   -WITH OIDS;
122   -ALTER TABLE alimentacao.cardapio OWNER TO portabilis;
123   -GRANT ALL ON TABLE alimentacao.cardapio TO portabilis;
124   -
125   --- Table: alimentacao.produto_grupo
126   --- DROP TABLE alimentacao.produto_grupo;
127   -CREATE TABLE alimentacao.produto_grupo
128   -(
129   - idpg integer NOT NULL DEFAULT nextval('alimentacao.produto_grupo_idpg_seq'::regclass),
130   - descricao character varying(20) NOT NULL,
131   - CONSTRAINT pk_produto_grupo PRIMARY KEY (idpg)
132   -)
133   -WITH OIDS;
134   -ALTER TABLE alimentacao.produto_grupo OWNER TO portabilis;
135   -GRANT ALL ON TABLE alimentacao.produto_grupo TO portabilis;
136   --- Table: alimentacao.produto_unidade
137   --- DROP TABLE alimentacao.produto_unidade;
138   -CREATE TABLE alimentacao.produto_unidade
139   -(
140   - idpu integer NOT NULL DEFAULT nextval('alimentacao.produto_unidade_idpu_seq'::regclass),
141   - descricao character varying(20) NOT NULL,
142   - unidade character varying(5) NOT NULL,
143   - CONSTRAINT pk_produto_unidade PRIMARY KEY (idpu)
144   -)
145   -WITH OIDS;
146   -ALTER TABLE alimentacao.produto_unidade OWNER TO portabilis;
147   -GRANT ALL ON TABLE alimentacao.produto_unidade TO portabilis;
148   --- Table: alimentacao.produto
149   --- DROP TABLE alimentacao.produto;
150   -CREATE TABLE alimentacao.produto
151   -(
152   - idpro integer NOT NULL DEFAULT nextval('alimentacao.produto_idpro_seq'::regclass),
153   - nm_produto character varying(50) NOT NULL,
154   - fator_correcao numeric(4) NOT NULL DEFAULT 0,
155   - fator_coccao numeric(4) NOT NULL DEFAULT 0,
156   - ref_produto_grupo integer NOT NULL,
157   - ref_produto_unidade integer NOT NULL,
158   - calorias numeric(4) NOT NULL DEFAULT 0,
159   - proteinas numeric(4) NOT NULL DEFAULT 0,
160   - CONSTRAINT pk_produto PRIMARY KEY (idpro),
161   - CONSTRAINT produto_ref_produto_grupo_fkey FOREIGN KEY (ref_produto_grupo)
162   - REFERENCES alimentacao.produto_grupo (idpg) MATCH SIMPLE
163   - ON UPDATE RESTRICT ON DELETE RESTRICT,
164   - CONSTRAINT produto_ref_produto_unidade_fkey FOREIGN KEY (ref_produto_unidade)
165   - REFERENCES alimentacao.produto_unidade (idpu) MATCH SIMPLE
166   - ON UPDATE RESTRICT ON DELETE RESTRICT
167   -)
168   -WITH OIDS;
169   -ALTER TABLE alimentacao.produto OWNER TO portabilis;
170   -GRANT ALL ON TABLE alimentacao.produto TO portabilis;
171   -
172   --- Table: alimentacao.fornecedor
173   --- DROP TABLE alimentacao.fornecedor;
174   -CREATE TABLE alimentacao.fornecedor
175   -(
176   - idpes integer NOT NULL,
177   - descricao character varying(100),
178   - CONSTRAINT pk_fornecedor PRIMARY KEY (idpes),
179   - CONSTRAINT fornecedor_ref_juridica_fkey FOREIGN KEY (idpes)
180   - REFERENCES cadastro.juridica (idpes) MATCH SIMPLE
181   - ON UPDATE RESTRICT ON DELETE RESTRICT
182   -)
183   -WITH OIDS;
184   -ALTER TABLE alimentacao.fornecedor OWNER TO portabilis;
185   -GRANT ALL ON TABLE alimentacao.fornecedor TO portabilis;
186   -
187   --- Table: alimentacao.produto_fornecedor
188   --- DROP TABLE alimentacao.produto_fornecedor;
189   -CREATE TABLE alimentacao.produto_fornecedor
190   -(
191   - idpf integer NOT NULL DEFAULT nextval('alimentacao.produto_fornecedor_idpf_seq'::regclass),
192   - ref_produto integer NOT NULL,
193   - ref_fornecedor integer NOT NULL,
194   - ano numeric(4) NOT NULL,
195   - mes_inicio numeric(2) NOT NULL,
196   - mes_fim numeric(2) NOT NULL,
197   - pesoouvolume_un numeric(7,2),
198   - preco_un numeric(5,2),
199   - agri_familiar smallint NOT NULL DEFAULT 0,
200   - CONSTRAINT pk_produto_fornecedor PRIMARY KEY (idpf),
201   - CONSTRAINT produto_forncedor_ref_fornecedor_fkey FOREIGN KEY (ref_fornecedor)
202   - REFERENCES alimentacao.fornecedor (idpes) MATCH SIMPLE
203   - ON UPDATE RESTRICT ON DELETE RESTRICT,
204   - CONSTRAINT produto_fornecedor_ref_produto_fkey FOREIGN KEY (ref_produto)
205   - REFERENCES alimentacao.produto (idpro) MATCH SIMPLE
206   - ON UPDATE RESTRICT ON DELETE RESTRICT
207   -)
208   -WITH OIDS;
209   -ALTER TABLE alimentacao.produto_fornecedor OWNER TO portabilis;
210   -GRANT ALL ON TABLE alimentacao.produto_fornecedor TO portabilis;
211   -
212   --- Table: alimentacao.envio_mensal_padroes
213   --- DROP TABLE alimentacao.envio_mensal_padroes;
214   -
215   -CREATE TABLE alimentacao.envio_mensal_padroes
216   -(
217   - idemp integer NOT NULL DEFAULT nextval('alimentacao.envio_mensal_padroes_idemp_seq'::regclass),
218   - ano numeric(4) NOT NULL,
219   - mes numeric(2) NOT NULL,
220   - dias smallint NOT NULL,
221   - refeicoes smallint NOT NULL,
222   - CONSTRAINT pk_envio_mensal_padores_idemp PRIMARY KEY (idemp)
223   -)
224   -WITH OIDS;
225   -ALTER TABLE alimentacao.envio_mensal_padroes OWNER TO portabilis;
226   -GRANT ALL ON TABLE alimentacao.envio_mensal_padroes TO portabilis;
227   -
228   --- Table: alimentacao.envio_mensal_escola
229   --- DROP TABLE alimentacao.envio_mensal_escola;
230   -CREATE TABLE alimentacao.envio_mensal_escola
231   -(
232   - ideme integer NOT NULL DEFAULT nextval('alimentacao.envio_mensal_escola_ideme_seq'::regclass),
233   - ref_escola integer NOT NULL,
234   - alunos integer NOT NULL DEFAULT 0,
235   - ano numeric(4) NOT NULL,
236   - mes numeric(2) NOT NULL,
237   - dias smallint NOT NULL,
238   - refeicoes smallint NOT NULL,
239   - dt_cadastro timestamp without time zone NOT NULL,
240   - CONSTRAINT pk_envio_mensal_escola_ideme PRIMARY KEY (ideme),
241   - CONSTRAINT envio_mensal_escola_ref_escola_fkey FOREIGN KEY (ref_escola)
242   - REFERENCES pmieducar.escola (cod_escola) MATCH SIMPLE
243   - ON UPDATE RESTRICT ON DELETE RESTRICT
244   -)
245   -WITH OIDS;
246   -ALTER TABLE alimentacao.envio_mensal_escola OWNER TO portabilis;
247   -GRANT ALL ON TABLE alimentacao.envio_mensal_escola TO portabilis;
248   -
249   --- Table: alimentacao.envio_mensal_escola_produto
250   --- DROP TABLE alimentacao.envio_mensal_escola_produto;
251   -CREATE TABLE alimentacao.envio_mensal_escola_produto
252   -(
253   - ref_envio_mensal_escola integer NOT NULL,
254   - ref_produto integer NOT NULL,
255   - pesoouvolume numeric(7,2) NOT NULL DEFAULT 0,
256   - CONSTRAINT pk_envio_mensal_escola_produto PRIMARY KEY (ref_envio_mensal_escola, ref_produto),
257   - CONSTRAINT envio_mensal_escola_produto_ref_envio_mensal_escola_fkey FOREIGN KEY (ref_envio_mensal_escola)
258   - REFERENCES alimentacao.envio_mensal_escola (ideme) MATCH SIMPLE
259   - ON UPDATE RESTRICT ON DELETE RESTRICT,
260   - CONSTRAINT envio_mensal_escola_ref_produto_fkey FOREIGN KEY (ref_produto)
261   - REFERENCES alimentacao.produto (idpro) MATCH SIMPLE
262   - ON UPDATE RESTRICT ON DELETE RESTRICT
263   -)
264   -WITH OIDS;
265   -ALTER TABLE alimentacao.envio_mensal_escola_produto OWNER TO portabilis;
266   -GRANT ALL ON TABLE alimentacao.envio_mensal_escola_produto TO portabilis;
267   -
268   --- Table: alimentacao.imc
269   --- DROP TABLE alimentacao.imc;
270   -CREATE TABLE alimentacao.imc
271   -(
272   - idimc integer NOT NULL DEFAULT nextval('alimentacao.imc_idimc_seq'::regclass),
273   - ref_escola integer NOT NULL,
274   - ref_aluno integer NOT NULL,
275   - ref_serie integer NOT NULL,
276   - dt_cadastro timestamp without time zone NOT NULL,
277   - altura numeric(5,2) NOT NULL,
278   - peso numeric(5,2) NOT NULL,
279   - imc numeric(5,2) NOT NULL,
280   - observacao character varying(200),
281   - CONSTRAINT pk_imc PRIMARY KEY (idimc),
282   - CONSTRAINT imc_ref_aluno_fkey FOREIGN KEY (ref_aluno)
283   - REFERENCES pmieducar.aluno (cod_aluno) MATCH SIMPLE
284   - ON UPDATE RESTRICT ON DELETE RESTRICT,
285   - CONSTRAINT imc_ref_escola_fkey FOREIGN KEY (ref_escola)
286   - REFERENCES pmieducar.escola (cod_escola) MATCH SIMPLE
287   - ON UPDATE RESTRICT ON DELETE RESTRICT,
288   - CONSTRAINT imc_ref_serie FOREIGN KEY (ref_serie)
289   - REFERENCES pmieducar.serie (cod_serie) MATCH SIMPLE
290   - ON UPDATE RESTRICT ON DELETE RESTRICT
291   -)
292   -WITH OIDS;
293   -ALTER TABLE alimentacao.imc OWNER TO portabilis;
294   -GRANT ALL ON TABLE alimentacao.imc TO portabilis;
295   -
296   --- Inclusão dos menus
297   -INSERT INTO PORTAL.MENU_MENU(cod_menu_menu,nm_menu) VALUES(1000,'i-Educar - Alimentação');
298   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10000,1000,2, 'Cardápio', 'alimentacao_cardapio_lst.php',3);
299   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10001,1000,2, 'Nutricionista Escolas', 'alimentacao_nutricionista_escola_lst.php',3);
300   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10002,1000,2, 'Produtos', 'alimentacao_produto_lst.php',3);
301   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10003,1000,2, 'Fornecedores', 'alimentacao_fornecedor_lst.php',3);
302   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10004,1000,2, 'Produto Fornecedor', 'alimentacao_produto_fornecedor_lst.php',3);
303   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10005,1000,2, 'Envio Mensal Escola', 'alimentacao_envio_mensal_escola_lst.php',3);
304   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10006,1000,2, 'IMC', 'alimentacao_imc_lst.php',3);
305   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10007,1000,2, 'Relatório - IMC por Escola', 'alimentacao_relatorio_imc_escola.php',3);
306   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10008,1000,2, 'Relatório - IMC por Série', 'alimentacao_relatorio_imc_serie.php',3);
307   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10009,1000,2, 'Relatório - Resumo por Escola', 'alimentacao_relatorio_resumo_escola.php',3);
308   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10010,1000,2, 'Relatório - Resumo por Mês', 'alimentacao_relatorio_resumo_mes.php',3);
309   -INSERT INTO PORTAL.MENU_SUBMENU( cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) VALUES(10011,1000,2, 'Envio Mensal Padrões', 'alimentacao_envio_mensal_padroes_lst.php',3);
310   -INSERT INTO ALIMENTACAO.PRODUTO_GRUPO(descricao) VALUES('Menos Perecíveis');
311   -INSERT INTO ALIMENTACAO.PRODUTO_GRUPO(descricao) VALUES('Mais Perecíveis');
312   -INSERT INTO ALIMENTACAO.PRODUTO_GRUPO(descricao) VALUES('Não Perecível');
313   -
314   -INSERT INTO ALIMENTACAO.PRODUTO_UNIDADE(descricao,unidade) VALUES('Kg - Quilograma','Kg');
315   -INSERT INTO ALIMENTACAO.PRODUTO_UNIDADE(descricao,unidade) VALUES('L - Litros','L');