Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F11222047
DrawTables.pm
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Subscribers
None
DrawTables.pm
View Options
package
DrawTables
;
require
Exporter
;
use
Gettestdata
qw(%newhash)
;
use
strict
;
##use warnings; To see warnings while debugging, uncomment next line:
use
CGI::Carp
qw(warningsToBrowser fatalsToBrowser)
;
our
@ISA
=
qw(Exporter)
;
our
@EXPORT
=
qw(newtable newsingPtable newdoubPtableTri newdoubPtableNoDiag)
;
our
$VERSION
=
1.00
;
my
$tdopt1
=
'align=center'
;
my
$tdopt2
=
''
;
my
$tdopt3
=
'bgcolor="#F1F1F1" WIDTH = 140 align=center'
;
my
$inopt1
=
'TYPE=TEXT SIZE=15 MAXLENGTH=20'
;
my
$inopt2
=
$inopt1
;
# will be changed further down...
my
$blankcell
=
'<td bgcolor="#F1F1F1" WIDTH = 110> </td>'
;
my
$i
=
''
;
my
$j
=
''
;
my
$k
=
''
;
sub
newtable
{
my
$str
=
$_
[
0
];
if
(
$newhash
{
$str
}{
type
}
eq
"singP"
){
newsingPtable
(
$str
);
}
elsif
(
$newhash
{
$str
}{
type
}
eq
"doubPTri"
){
newdoubPtableTri
(
$str
);
}
elsif
(
$newhash
{
$str
}{
type
}
eq
"doubPNoDiag"
){
newdoubPtableNoDiag
(
$str
);
}
elsif
(
$newhash
{
$str
}{
type
}
eq
"doubPRect"
){
newdoubPtableRect
(
$str
);
}
elsif
(
$newhash
{
$str
}{
type
}
eq
"other"
){
newothertable
(
$str
);
}
else
{
print
"Error in sub newtable.'.$str.' <br>"
;
die
;
}
}
sub
newsingPtable
{
my
$str
=
$_
[
0
];
my
$nelements
=
$newhash
{
$str
}{
nPj
};
if
(
$newhash
{
$str
}{
req
}
eq
'Needed'
){
print
$newhash
{
$str
}{
title
}
.
'<br>'
.
"\n"
;
print
'<table border="0">'
.
"\n"
.
' <td WIDTH=20></td>'
.
"\n"
.
' <td>'
.
"\n"
.
' <table border="0">'
.
"\n"
.
' <tr>'
.
"\n"
;
for
(
$i
=
1
;
$i
<=
$nelements
;
++
$i
){
print
' <td '
.
$tdopt1
.
'>'
.
' '
.
$newhash
{
$str
}{
name
}[
0
]
.
$i
.
$newhash
{
$str
}{
name
}[
1
]
.
' </td>'
.
"\n"
;
}
print
' </tr>'
.
"\n"
.
' <tr>'
.
"\n"
;
for
(
$i
=
1
;
$i
<=
$nelements
;
++
$i
){
print
' <td '
.
$tdopt2
.
'>'
.
' <INPUT VALUE="'
.
"$newhash{$str}{array}[$i-1]"
.
'" NAME="'
.
$newhash
{
$str
}{
label
}[
0
]
.
$i
.
$newhash
{
$str
}{
label
}[
1
]
.
'" '
.
$inopt1
.
'>'
.
' </td>'
.
"\n"
;
}
print
' </tr>'
.
"\n"
.
' </table>'
.
"\n"
.
' </td>'
.
"\n"
.
'</table>'
.
"\n"
.
' '
.
"\n"
;
}
elsif
(
$newhash
{
$str
}{
req
}
eq
'Not needed'
){
#do nothing
}
else
{
print
'problem with newhash{'
.
$str
.
'}: have not set req'
;
die
;
}
};
sub
newdoubPtableTri
{
my
$str
=
$_
[
0
];
my
$n
=
$newhash
{
$str
}{
nPj
};
if
(
$newhash
{
$str
}{
req
}
eq
'Needed'
){
print
$newhash
{
$str
}{
title
}
.
'<br>'
.
"\n"
;
$k
=
0
;
print
'<table border="0">'
.
"\n"
;
print
'<tr>'
.
"\n"
;
for
(
$i
=
-
2
;
$i
<=
$n
;
++
$i
){
if
(
$i
==
-
2
)
{
print
'<td align=right> <i>j</i> </td>'
.
"\n"
;
}
elsif
(
$i
==
-
1
)
{
print
'<td align=right> <font size=+1> \ </font> </td>'
.
"\n"
;
}
elsif
(
$i
==
0
)
{
print
'<td align=right> <i>i</i> </td>'
.
"\n"
;
}
else
{
print
'<td '
.
$tdopt1
.
'> '
.
$i
.
' </td>'
.
"\n"
;
}
}
print
'</tr>'
.
"\n"
;
for
(
$j
=
1
;
$j
<=
$n
;
++
$j
){
print
'<tr>'
.
"\n"
;
for
(
$i
=
-
2
;
$i
<=
$n
;
++
$i
){
if
(
$i
==
-
2
)
{
print
'<td align=right> '
.
$j
.
' </td>'
.
"\n"
;
}
elsif
((
$i
==
-
1
)
||
(
$i
==
0
)){
print
'<td align=right> </td>'
.
"\n"
;
}
elsif
(
$i
>
$j
)
{
print
$blankcell
.
"\n"
;}
else
{
$k
=
$k
+
1
;
print
'<td '
.
$tdopt2
.
' >
<INPUT VALUE="'
.
"$newhash{$str}{array}[$k-1]"
.
'" '
.
'NAME="'
.
$newhash
{
$str
}{
label
}[
0
]
.
$j
.
$newhash
{
$str
}{
label
}[
1
]
.
$i
.
$newhash
{
$str
}{
label
}[
2
]
.
'" '
.
$inopt1
.
'>'
.
'</td>'
.
"\n"
;
}
}
print
'</tr>'
.
"\n"
;
}
print
'</table>'
.
"\n"
;
print
' '
.
"\n"
;
}
}
sub
newdoubPtableNoDiag
{
my
$str
=
$_
[
0
];
my
$n
=
$newhash
{
$str
}{
nPj
};
if
(
$newhash
{
$str
}{
req
}
eq
'Needed'
){
print
$newhash
{
$str
}{
title
}
.
'<br>'
.
"\n"
;
$k
=
0
;
print
'<table border="0">'
.
"\n"
;
print
'<tr>'
.
"\n"
;
for
(
$i
=
-
2
;
$i
<=
$n
;
++
$i
){
if
(
$i
==
-
2
)
{
print
'<td align=right> <i>j</i> </td>'
.
"\n"
;
}
elsif
(
$i
==
-
1
)
{
print
'<td align=right> <font size=+1> \ </font> </td>'
.
"\n"
;
}
elsif
(
$i
==
0
)
{
print
'<td align=right> <i>i</i> </td>'
.
"\n"
;
}
else
{
print
'<td '
.
$tdopt1
.
'> '
.
$i
.
' </td>'
.
"\n"
;
}
}
print
'</tr>'
.
"\n"
;
for
(
$j
=
1
;
$j
<=
$n
;
++
$j
)
{
print
'<tr>'
.
"\n"
;
for
(
$i
=
-
2
;
$i
<=
$n
;
++
$i
){
if
(
$i
==
-
2
)
{
print
'<td align=right> '
.
$j
.
' </td>'
.
"\n"
;
}
elsif
((
$i
==
-
1
)
||
(
$i
==
0
))
{
print
'<td align=right> </td>'
.
"\n"
;
}
elsif
(
$i
==
$j
)
{
print
$blankcell
.
"\n"
;
}
else
{
$k
=
$k
+
1
;
print
'<td '
.
$tdopt2
.
' ><INPUT VALUE="'
.
$newhash
{
$str
}{
array
}[
$k
-
1
]
.
'" '
.
'NAME="'
.
$newhash
{
$str
}{
label
}[
0
]
.
$j
.
$newhash
{
$str
}{
label
}[
1
]
.
$i
.
$newhash
{
$str
}{
label
}[
2
]
.
'" '
.
$inopt1
.
'>'
.
'</td>'
.
"\n"
;
}
}
print
'</tr>'
.
"\n"
;
}
print
'</table>'
.
"\n"
;
print
' '
.
"\n"
;
}
}
sub
newdoubPtableRect
{
my
$str
=
$_
[
0
];
my
$nj
=
$newhash
{
$str
}{
nPj
};
my
$ni
=
$newhash
{
$str
}{
nPi
};
if
(
$newhash
{
$str
}{
req
}
eq
'Needed'
){
print
$newhash
{
$str
}{
title
}
.
'<br>'
.
"\n"
;
$k
=
0
;
print
'<table border="0">'
.
"\n"
;
print
'<tr>'
.
"\n"
;
for
(
$i
=
-
2
;
$i
<=
$ni
;
++
$i
){
if
(
$i
==
-
2
)
{
print
'<td align=right> <i>j</i> </td>'
.
"\n"
;
}
elsif
(
$i
==
-
1
)
{
print
'<td align=right> <font size=+1> \ </font> </td>'
.
"\n"
;
}
elsif
(
$i
==
0
)
{
print
'<td align=right> <i>i</i> </td>'
.
"\n"
;
}
else
{
print
'<td '
.
$tdopt1
.
'> '
.
$i
.
' </td>'
.
"\n"
;
}
}
print
'</tr>'
.
"\n"
;
for
(
$j
=
1
;
$j
<=
$nj
;
++
$j
)
{
print
'<tr>'
.
"\n"
;
for
(
$i
=
-
2
;
$i
<=
$ni
;
++
$i
){
if
(
$i
==
-
2
)
{
print
'<td align=right> '
.
$j
.
' </td>'
.
"\n"
;
}
elsif
((
$i
==
-
1
)
||
(
$i
==
0
))
{
print
'<td align=right> </td>'
.
"\n"
;
}
else
{
$k
=
$k
+
1
;
print
'<td '
.
$tdopt2
.
' ><INPUT VALUE="'
.
$newhash
{
$str
}{
array
}[
$k
-
1
]
.
'" '
.
'NAME="'
.
$newhash
{
$str
}{
label
}[
0
]
.
$j
.
$newhash
{
$str
}{
label
}[
1
]
.
$i
.
$newhash
{
$str
}{
label
}[
2
]
.
'" '
.
$inopt1
.
'>'
.
'</td>'
.
"\n"
;
}
}
print
'</tr>'
.
"\n"
;
}
print
'</table>'
.
"\n"
;
print
' '
.
"\n"
;
}
}
sub
newothertable
{
my
$str
=
$_
[
0
];
my
$nelements
=
$newhash
{
$str
}{
nPj
};
if
(
$newhash
{
$str
}{
req
}
eq
'Needed'
){
print
$newhash
{
$str
}{
title
}
.
'<br>'
.
"\n"
;
print
'<table border="0">'
.
"\n"
.
' <td WIDTH=20></td>'
.
"\n"
.
' <td>'
.
"\n"
.
' <table border="0">'
.
"\n"
.
' <tr>'
.
"\n"
;
for
(
$i
=
1
;
$i
<=
$nelements
;
++
$i
){
print
' <td '
.
$tdopt1
.
'>'
.
' '
.
$newhash
{
$str
}{
name
}
.
' </td>'
.
"\n"
;
}
print
' </tr>'
.
"\n"
.
' <tr>'
.
"\n"
;
for
(
$i
=
1
;
$i
<=
$nelements
;
++
$i
){
print
' <td '
.
$tdopt2
.
'>'
.
' <INPUT VALUE="'
.
"$newhash{$str}{array}[$i-1]"
.
'" NAME="'
.
$newhash
{
$str
}{
label
}
.
'" '
.
$inopt1
.
'>'
.
' </td>'
.
"\n"
;
}
print
' </tr>'
.
"\n"
.
' </table>'
.
"\n"
.
' </td>'
.
"\n"
.
'</table>'
.
"\n"
.
' '
.
"\n"
;
}
};
1
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 14, 11:19 AM (10 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5068250
Default Alt Text
DrawTables.pm (6 KB)
Attached To
rHIGGSBOUNDSSVN higgsboundssvn
Event Timeline
Log In to Comment