table_tree.js
4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
**********************************************************************************
* *
* @package URBEM CNM - Soluções em Gestão Pública *
* @copyright (c) 2013 Confederação Nacional de Municípos *
* @author Confederação Nacional de Municípios *
* *
* O URBEM CNM é um software livre; você pode redistribuí-lo e/ou modificá-lo sob *
* os termos da Licença Pública Geral GNU conforme publicada pela Fundação do *
* Software Livre (FSF - Free Software Foundation); na versão 2 da Licença. *
* *
* Este programa é distribuído na expectativa de que seja útil, porém, *
* SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU *
* ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral do GNU *
* para mais detalhes. *
* *
* Você deve ter recebido uma cópia da Licença Pública Geral do GNU "LICENCA.txt" *
* com este programa; se não, escreva para a Free Software Foundation Inc., *
* no endereço 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* *
**********************************************************************************
*/
/**
* Funções
* Data de Criação: 05/02/2007
* @author Analista: Lucas Stephanou
* @author Desenvolvedor: Lucas Stephanou
$Revision: 19882 $
$Name$
$Author: cassiano $
$Date: 2007-02-06 13:34:20 -0200 (Ter, 06 Fev 2007) $
Casos de uso: uc-01.01.00
*/
/* Ajax.Responders.register({
onUninitialized : imagem(),
onComplete : imagem()
});
*/
function entere(value,conteiner,id,e){
if ( e.keyCode == 13 ){
document.getElementById(id).innerHTML = "<span ondblclick=\"returnEdit('"+conteiner+"','"+value+"','"+id+"');\" >"+value+"</span>";
}else{
return false;
}
}
function returnEdit(conteiner,value,id){
input = "<input type=\"text\" onkeyup=\"entere(this.value,'"+conteiner+"','"+id+"',event)\" value=\""+value+" \" />";
document.getElementById(conteiner).innerHTML = input;
document.getElementById(conteiner).firstChild.select();
}
function hiddenController(table,control,arquivo){
rowSize = document.getElementById(table).rows.length/2;
for (i=1;i<rowSize;i++){
if (!control){
TableTreeReq( table + '_row_' + i , arquivo);
}
else{
TableTreeLineControl(table+'_row_'+i , 'none' , '' , 'none');
}
}
if (!control){
document.getElementById(table+'_openAll').style.display = 'none';
document.getElementById(table+'_closeAll').style.display = '';
}
else{
document.getElementById(table+'_openAll').style.display = '';
document.getElementById(table+'_closeAll').style.display = 'none';
}
return false;
}
function TableTreeLineControl( id , ValueSub, ValueMais, ValueMenos){
if ( ValueSub == '' ){
document.getElementById(id+'_sub').style.display =ValueSub ;
}else{
document.getElementById(id+'_sub').style.display =ValueSub ;
}
document.getElementById(id+'_mais').style.display = ValueMais ;
document.getElementById(id+'_menos').style.display = ValueMenos ;
}
function TableTreeReq( id , arquivo){
// coloca imagem do ajax
carregandoContainer(id);
return new Ajax.Updater
(
id+ '_sub_cell_2', arquivo ,
{
onSuccess: TableTreeLineControl( id , '' , 'none' , '' ) ,
asynchronous:true,
evalScripts:true
}
);
}
function carregandoContainer(id){
// captura imagem
var loading = window.parent.frames["telaPrincipal"].document.getElementById("carregando");
var src = loading.innerHTML;
var src_loading = window.parent.frames["telaPrincipal"].document.getElementById("ajax_carregando").src;
var alt_loading = window.parent.frames["telaPrincipal"].document.getElementById("ajax_carregando").alt;
// cria imagem de loading dinamicamente
var newLoading=document.createElement("img");
newLoading.setAttribute('src' , src_loading );
newLoading.setAttribute('alt' , alt_loading );
document.getElementById(id+'_sub_cell_2').innerHTML = src;
}