[interchange-cvs] interchange - heins modified 2 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Thu Oct 3 13:27:00 2002
User: heins
Date: 2002-10-03 17:26:29 GMT
Modified: lib/Vend Menu.pm
Modified: lib/Vend/Table Editor.pm
Log:
* Make possible to generate multiple tabbed displays per page by
setting different panel_id options.
* Change full_interpolate to first in ordered transforms, so that
menu entries that need to intepolate ITL do so before menu processing
is done.
Revision Changes Path
2.16 +3 -3 interchange/lib/Vend/Menu.pm
rev 2.16, prev_rev 2.15
Index: Menu.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Menu.pm,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -r2.15 -r2.16
--- Menu.pm 12 Sep 2002 05:19:35 -0000 2.15
+++ Menu.pm 3 Oct 2002 17:26:28 -0000 2.16
@@ -1,6 +1,6 @@
# Vend::Menu - Interchange payment processing routines
#
-# $Id: Menu.pm,v 2.15 2002/09/12 05:19:35 mheins Exp $
+# $Id: Menu.pm,v 2.16 2002/10/03 17:26:28 mheins Exp $
#
# Copyright (C) 2002 Mike Heins, <mike@perusion.net>
#
@@ -21,7 +21,7 @@
=20
package Vend::Menu;
=20
-$VERSION =3D substr(q$Revision: 2.15 $, 10);
+$VERSION =3D substr(q$Revision: 2.16 $, 10);
=20
use Vend::Util;
use strict;
@@ -1252,7 +1252,7 @@
}
=20
my @transform;
- my @ordered_transform =3D qw/page_class indicator_class localize entities=
nbsp/;
+ my @ordered_transform =3D qw/full_interpolate page_class indicator_class =
localize entities nbsp/;
my %ordered;
@ordered{@ordered_transform} =3D @ordered_transform;
=20
1.11 +53 -52 interchange/lib/Vend/Table/Editor.pm
rev 1.11, prev_rev 1.10
Index: Editor.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Editor.pm 28 Sep 2002 17:48:32 -0000 1.10
+++ Editor.pm 3 Oct 2002 17:26:29 -0000 1.11
@@ -1,6 +1,6 @@
# Vend::Table::Editor - Swiss-army-knife table editor for Interchange
#
-# $Id: Editor.pm,v 1.10 2002/09/28 17:48:32 mheins Exp $
+# $Id: Editor.pm,v 1.11 2002/10/03 17:26:29 mheins Exp $
#
# Copyright (C) 2002 ICDEVGROUP <interchange@icdevgroup.org>
# Copyright (C) 2002 Mike Heins <mike@perusion.net>
@@ -26,7 +26,7 @@
package Vend::Table::Editor;
=20
use vars qw($VERSION);
-$VERSION =3D substr(q$Revision: 1.10 $, 10);
+$VERSION =3D substr(q$Revision: 1.11 $, 10);
=20
use Vend::Util;
use Vend::Interpolate;
@@ -559,6 +559,7 @@
};
=20
my $id =3D $opt->{panel_id};
+ my $vpf =3D $id . '_';
my $num_panels =3D scalar(@$cont);
my $tabs_per_row =3D int( $opt->{panel_width} / $opt->{tab_width}) || 1;
my $num_rows =3D POSIX::ceil( $num_panels / $opt->{tab_width});
@@ -575,103 +576,103 @@
$c =3D~ s/x/$chars[$i] || 'e'/eg;
$colors[$i] =3D $c;
}
- my $cArray =3D qq{var colors =3D ['} . join("','", @colors) . qq{'];};
+ my $cArray =3D qq{var ${vpf}colors =3D ['} . join("','", @colors) . qq{']=
;};
#::logDebug("num rows=3D$num_rows");
my $out =3D <<EOF;
<SCRIPT language=3D"JavaScript">
<!--
-var panelID =3D "$id"
-var numDiv =3D $num_panels;
-var numRows =3D $num_rows;
-var tabsPerRow =3D $tabs_per_row;
-var numLocations =3D numRows * tabsPerRow
-var tabWidth =3D $opt->{tab_width}
-var tabHeight =3D $opt->{tab_height}
-var vOffset =3D $opt->{tab_vert_offset};
-var hOffset =3D $opt->{tab_horiz_offset};
+var ${vpf}panelID =3D "$id"
+var ${vpf}numDiv =3D $num_panels;
+var ${vpf}numRows =3D $num_rows;
+var ${vpf}tabsPerRow =3D $tabs_per_row;
+var ${vpf}numLocations =3D ${vpf}numRows * ${vpf}tabsPerRow
+var ${vpf}tabWidth =3D $opt->{tab_width}
+var ${vpf}tabHeight =3D $opt->{tab_height}
+var ${vpf}vOffset =3D $opt->{tab_vert_offset};
+var ${vpf}hOffset =3D $opt->{tab_horiz_offset};
$cArray
=20
-var divLocation =3D new Array(numLocations)
-var newLocation =3D new Array(numLocations)
-for(var i=3D0; i<numLocations; ++i) {
- divLocation[i] =3D i
- newLocation[i] =3D i
+var ${vpf}divLocation =3D new Array(${vpf}numLocations)
+var ${vpf}newLocation =3D new Array(${vpf}numLocations)
+for(var i=3D0; i<${vpf}numLocations; ++i) {
+ ${vpf}divLocation[i] =3D i
+ ${vpf}newLocation[i] =3D i
}
=20
-function getDiv(s,i) {
+function ${vpf}getDiv(s,i) {
var div
if (document.layers) {
- div =3D document.layers[panelID].layers[panelID+s+i]
+ div =3D document.layers[${vpf}panelID].layers[panelID+s+i]
} else if (document.all && !document.getElementById) {
- div =3D document.all[panelID+s+i]
+ div =3D document.all[${vpf}panelID+s+i]
} else {
- div =3D document.getElementById(panelID+s+i)
+ div =3D document.getElementById(${vpf}panelID+s+i)
}
return div
}
=20
-function setZIndex(div, zIndex) {
+function ${vpf}setZIndex(div, zIndex) {
if (document.layers) div.style =3D div;
div.style.zIndex =3D zIndex
}
=20
-function updatePosition(div, newPos) {
- newClip=3DtabHeight*(Math.floor(newPos/tabsPerRow)+1)
+function ${vpf}updatePosition(div, newPos) {
+ ${vpf}newClip=3D${vpf}tabHeight*(Math.floor(newPos/${vpf}tabsPerRow)+1)
if (document.layers) {
div.style=3Ddiv;
- div.clip.bottom=3DnewClip; // clip off bottom
+ div.clip.bottom=3D${vpf}newClip; // clip off bottom
} else {
- div.style.clip=3D"rect(0 auto "+newClip+" 0)"
+ div.style.clip=3D"rect(0 auto "+${vpf}newClip+" 0)"
}
- div.style.top =3D (numRows-(Math.floor(newPos/tabsPerRow) + 1)) * (tabHei=
ght-vOffset)
- div.style.left =3D (newPos % tabsPerRow) * tabWidth + (hOffset * (Math.fl=
oor(newPos / tabsPerRow)))
+ div.style.top =3D (${vpf}numRows-(Math.floor(newPos/${vpf}tabsPerRow) + 1=
)) * (${vpf}tabHeight-${vpf}vOffset)
+ div.style.left =3D (newPos % ${vpf}tabsPerRow) * ${vpf}tabWidth + (${vpf}=
hOffset * (Math.floor(newPos / ${vpf}tabsPerRow)))
}
=20
-function selectTab(n) {
+function ${vpf}selectTab(n) {
// n is the ID of the division that was clicked
// firstTab is the location of the first tab in the selected row
- var firstTab =3D Math.floor(divLocation[n] / tabsPerRow) * tabsPerRow
+ var firstTab =3D Math.floor(${vpf}divLocation[n] / ${vpf}tabsPerRow) * ${=
vpf}tabsPerRow
// newLoc is its new location
- for(var i=3D0; i<numDiv; ++i) {
+ for(var i=3D0; i<${vpf}numDiv; ++i) {
// loc is the current location of the tab
- var loc =3D divLocation[i]
+ var loc =3D ${vpf}divLocation[i]
// If in the selected row
- if(loc >=3D firstTab && loc < (firstTab + tabsPerRow)) newLocation[i] =
=3D (loc - firstTab)
+ if(loc >=3D firstTab && loc < (firstTab + ${vpf}tabsPerRow)) ${vpf}newLo=
cation[i] =3D (loc - firstTab)
else if(loc < tabsPerRow) newLocation[i] =3D firstTab+(loc % tabsPerRow)
else newLocation[i] =3D loc
}
// Set tab positions & zIndex
// Update location
var j =3D 1;
- for(var i=3D0; i<numDiv; ++i) {
- var loc =3D newLocation[i]
- var div =3D getDiv("panel",i)
- var tdiv =3D getDiv("tab",i)
+ for(var i=3D0; i<${vpf}numDiv; ++i) {
+ var loc =3D ${vpf}newLocation[i]
+ var div =3D ${vpf}getDiv("panel",i)
+ var tdiv =3D ${vpf}getDiv("tab",i)
if(i =3D=3D n) {
- setZIndex(div, numLocations +1);
+ ${vpf}setZIndex(div, ${vpf}numLocations +1);
div.style.display =3D 'block';
- tdiv.style.backgroundColor =3D colors[0];
- div.style.backgroundColor =3D colors[0];
+ tdiv.style.backgroundColor =3D ${vpf}colors[0];
+ div.style.backgroundColor =3D ${vpf}colors[0];
}
else {
- setZIndex(div, numLocations - loc)
+ ${vpf}setZIndex(div, ${vpf}numLocations - loc)
div.style.display =3D 'none';
- tdiv.style.backgroundColor =3D colors[j];
- div.style.backgroundColor =3D colors[j++];
+ tdiv.style.backgroundColor =3D ${vpf}colors[j];
+ div.style.backgroundColor =3D ${vpf}colors[j++];
}
- divLocation[i] =3D loc
- updatePosition(tdiv, loc)
- if(i =3D=3D n) setZIndex(tdiv, numLocations +1)
- else setZIndex(tdiv,numLocations - loc)
+ ${vpf}divLocation[i] =3D loc
+ ${vpf}updatePosition(tdiv, loc)
+ if(i =3D=3D n) ${vpf}setZIndex(tdiv, ${vpf}numLocations +1)
+ else ${vpf}setZIndex(tdiv,${vpf}numLocations - loc)
}
}
=20
// Nav4: position component into a table
-function positionPanel() {
+function ${vpf}positionPanel() {
document.$id.top=3Ddocument.panelLocator.pageY;
document.$id.left=3Ddocument.panelLocator.pageX;
}
-if (document.layers) window.onload=3DpositionPanel;
+if (document.layers) window.onload=3D${vpf}positionPanel;
=20
//-->
</SCRIPT>
@@ -723,7 +724,7 @@
$opt->{panel_append}
</DIV>
<DIV
- onclick=3D"selectTab($i)"
+ onclick=3D"${vpf}selectTab($i)"
id=3D"${id}tab$i"
class=3D"${id}tab"
style=3D"
@@ -750,7 +751,7 @@
top=3D"$top"
z-index=3D"$zi"
id=3D"${id}tab$i"
- onfocus=3D"selectTab($i)"
+ onfocus=3D"${vpf}selectTab($i)"
>
<table width=3D"100%" cellpadding=3D2 cellspacing=3D0>
$tit->[$i]
@@ -780,7 +781,7 @@
">
$s1
<script>
- selectTab($start_index);
+ ${vpf}selectTab($start_index);
</script>
</div>
EOF