[interchange-cvs] interchange - heins modified 4 files

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Sun Dec 1 11:39:00 2002


User:      heins
Date:      2002-12-01 16:38:39 GMT
Modified:  .        MANIFEST
Modified:  code/UI_Tag menu_load.coretag
Modified:  dist/lib/UI/pages/admin menu_editor.html
Added:     dist/foundation/templates/components category_vertical_tree
Log:
* Add new category_vertical_tree component supplied by Rene Hertell.
  This takes the output of a menu tree built by the menu_editor and
  displays all items in a fixed fashion ala the common category_vertical
  component.

* Fix a few things in the menu loading system and the menu editor:

	-- Honor the build_large parameter
	-- Properly escape form parameters generated in menu_load
	-- Allow selection of the different build groups in area/cat
	   menu load function
    -- Don't rely on Values for settings of defaults in the menu_loader
	-- Minor changes to styles in menu_load portion of menu_editor
	-- Make image setting more efficient and reliable

Revision  Changes    Path
2.73      +4 -0      interchange/MANIFEST


rev 2.73, prev_rev 2.72
Index: MANIFEST
===================================================================
RCS file: /var/cvs/interchange/MANIFEST,v
retrieving revision 2.72
retrieving revision 2.73
diff -u -r2.72 -r2.73
--- MANIFEST	20 Nov 2002 18:52:16 -0000	2.72
+++ MANIFEST	1 Dec 2002 16:38:39 -0000	2.73
@@ -630,6 +630,8 @@
 dist/foundation/pages/splash.html
 dist/foundation/pages/stock-alert-added.html
 dist/foundation/pages/stock-alert.html
+dist/foundation/pages/survey/graph.html
+dist/foundation/pages/survey/graph.png.html
 dist/foundation/pages/survey/standard.html
 dist/foundation/pages/swap_results.html
 dist/foundation/products/2ndDayAir.csv
@@ -701,6 +703,7 @@
 dist/foundation/templates/components/category_horizontal
 dist/foundation/templates/components/category_vert_toggle
 dist/foundation/templates/components/category_vertical
+dist/foundation/templates/components/category_vertical_tree
 dist/foundation/templates/components/cross
 dist/foundation/templates/components/fortune
 dist/foundation/templates/components/product_flyout
@@ -1150,6 +1153,7 @@
 eg/news_feature/products/news.txt
 eg/news_feature/templates/components/news
 eg/reset_order_number
+eg/survey_graph.tag
 eg/te
 eg/usertag/benchmark
 eg/usertag/sleep



1.2       +9 -4      interchange/code/UI_Tag/menu_load.coretag


rev 1.2, prev_rev 1.1
Index: menu_load.coretag
===================================================================
RCS file: /var/cvs/interchange/code/UI_Tag/menu_load.coretag,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- menu_load.coretag	6 Nov 2002 19:41:48 -0000	1.1
+++ menu_load.coretag	1 Dec 2002 16:38:39 -0000	1.2
@@ -44,6 +44,9 @@
 
 		push @out, qq{va=banner_image=$row->{banner_image}} if $row->{banner_image};
 		push @out, qq{va=banner_text=$row->{banner_text}} if $row->{banner_text};
+		for(@out) {
+			s/(.*?=)(.*)/$1 . Vend::Util::hexify($2)/ges;
+		}
 		$arg = join "&", @out;
 		$nrow->{form} = $arg;
 	  }
@@ -105,7 +108,7 @@
 			my $tname = $db->name();
 #::logDebug("LARGE=" . $db->config('LARGE'));
 			$opt->{key_field} ||= $db->config('KEY');
-			if(! $opt->{build_even_large} and $db->config('LARGE')) {
+			if(! $opt->{even_large} and $db->config('LARGE')) {
 				Vend::Tags->error({ set => errmsg(
 										"%s database %s for tree write: %s",
 										'check',
@@ -221,7 +224,7 @@
 							};
 
 #Debug("LARGE=" . $db->config('LARGE'));
-				if(! $CGI->{qmenu_even_large} and $db->config('LARGE')) {
+				if(! $opt->{even_large} and $db->config('LARGE')) {
 					$Tag->error({ set => errmsg(
 									"%s database %s for tree write: %s",
 									'check',
@@ -316,7 +319,10 @@
 					last AREABUILD;
 				};
 #Debug("LARGE=" . $db->config('LARGE'));
-			my $q = qq{ SELECT * FROM $tab ORDER BY sort };
+			my $q = qq{ SELECT * FROM $tab};
+			$q .= qq{ WHERE sel = '$opt->{sel}'}
+				if $opt->{sel};
+			$q .= qq{ ORDER BY sort };
 			my $ary = $db->query({ sql => $q, hashref => 1 } )
 							or do {
 								Vend::Tags->error({
@@ -384,7 +390,6 @@
 				push @out, join "\t", @{$_}{@menufields};
 #Debug("pushing out --> row=" . uneval($_));
 			}
-#Debug("qmenu_data=$Scratch->{qmenu_data}");
 		}
 	}
 	elsif($type eq 'html') {



1.1                  interchange/dist/foundation/templates/components/category_vertical_tree


rev 1.1, prev_rev 1.0
Index: category_vertical_tree
===================================================================
[comment]
ui_name: category_vertical_tree
ui_type: component
ui_class: vertical
ui_group: Navigation
ui_label: Vertical category list for the Menu-editor and tree-database

menu_set:
	advanced: 1
	db: tree
	help: Defines which menu-set is displayed on this page
	label: Menu set
	lookup: mgroup
	type: select

level_spacing:
	advanced: 1
	code: level_spacing
	help: Select the amount of spaces you want your subcategories to be indented
	label: Select indent
	options: 1=1 space,2=2 spaces,3=3 spaces,4=4 spaces,5=5 spaces,6=6 spaces,7=7 spaces,8=8 spaces,9=9 spaces,10=10 spaces
	type: select

subcategory_dot:
	advanced: 1
	code: subcategory_dot
	help: Select if you want a dot () before each subcategory.
	label: Select dot
	options: 0=No,1=Yes
	type: select

timed:
	advanced: 1
	code: timed
	help: Makes more efficient for large/busy catalogs
	label: Use timed build
	options: 0=No, 5=5 minutes, 10=10 minutes, 20=20 minutes, 60=60 minutes, 1440=Daily
	type: select

[/comment]

[seti dot][control subcategory_dot][/seti]

<!-- BEGIN COMPONENT [control component category_vertical_tree] -->
<tr><td align="left" class="categorybar">
  <br>
  <table width="90%" align="center">
    <tr><td align="left" valign="top">
    [tree
        table=tree
        sort=code
        spacing="[control level_spacing]"
        spacer="&nbsp;"
        start="[control menu_set]"
        master=parent_fld
        subordinate=code
        full=1]
        [if-item-param !mv_level]
        <table cellpadding="2" cellspacing="0" border="0">
          <tr>
            <td valign="top" class="categorybar" colspan="2" align="left">
              <b>[if-item-param page]<a href="[area href='[item-param page]' form=|[item-param form]|]" class="barlink">[item-param name]</a>[else][item-param name][/else][/if-item-param]</b>
            </td>
          </tr>
        </table>
        [/if-item-param]

        [if-item-param mv_level]
        <table cellpadding="0" cellspacing="1">
          <tr>
            <td valign="top" class="categorybar">
            [item-param mv_spacer][if scratch dot]&#149;[/if]
            </td>
            <td valign="top">
                [if-item-param page]<a href="[area href='[item-param page]' form=|[item-param form]|]"
class="barlink">[item-param name]</a>[else][item-param
name][/else][/if-item-param]<BR>
            </td>
          </tr>
        </table>
        [/if-item-param]
    [/tree]
    </td></tr>
  </table>
  <br>
</td></tr>

<!-- END COMPONENT [control component category_vertical_tree] -->



2.18      +88 -46    interchange/dist/lib/UI/pages/admin/menu_editor.html


rev 2.18, prev_rev 2.17
Index: menu_editor.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/menu_editor.html,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -r2.17 -r2.18
--- menu_editor.html	6 Nov 2002 19:41:48 -0000	2.17
+++ menu_editor.html	1 Dec 2002 16:38:39 -0000	2.18
@@ -76,6 +76,7 @@
 			table => $CGI->{qmenu_products},
 			comb_field => $CGI->{qmenu_comb_field},
 			type => 'comb_category',
+			even_large => $CGI->{qmenu_even_large},
 		);
 
 		$CGI->{qmenu_text} = $Tag->menu_load(\%opt);
@@ -92,6 +93,7 @@
 			table => $CGI->{qmenu_products},
 			first_field => $CGI->{qmenu_toplevel_field},
 			second_field => $CGI->{qmenu_sublevel_field},
+			even_large => $CGI->{qmenu_even_large},
 			type => 'tree',
 		);
 
@@ -101,12 +103,21 @@
 	}
 	elsif ($CGI->{qmenu_cat}) {
 		# Build menu from top&sub level tables
+		if($CGI->{qmenu_sel_value} =~ /\S/) {
+			$CGI->{qmenu_sel_value} =~ s/^\s+//;
+			$CGI->{qmenu_sel_value} =~ s/\s+$//;
+		}
+		else {
+			undef $CGI->{qmenu_sel_value};
+		}
 
 		$CGI->{qmenu_toplevel} ||= 'area';
 		$CGI->{qmenu_sublevel} ||= 'cat';
 		my %opt = (
 			table => $CGI->{qmenu_toplevel},
+			sel => $CGI->{qmenu_sel_value},
 			cat_table => $CGI->{qmenu_sublevel},
+			even_large => $CGI->{qmenu_even_large},
 			type => 'cat_menu',
 		);
 
@@ -395,10 +406,11 @@
 	<span class=cmessage>[warnings auto=1]</span>
 	[error all=1 text="<ul class=cerror><li>%s</ul>" joiner="<li>"]
 	</td>
-	<td width="30%">
+	<td width="30%" rowspan=2>
 
 Build menu tree from database table(s):<br>
 [tabbed-display panel-width=300 panel-height=100
+        js-prefix=mvtb_
 		panel_style="
 			font-family: sans-serif;
 			font-size: 10px;
@@ -423,11 +435,11 @@
                 <input type=hidden name=mv_session_id value="[data session id]">
                 <input type=hidden name=mv_action value="back">
 
-[if !value qmenu_products]
-        [value name=qmenu_products set=products hide=1]
-        [value name=qmenu_comb_field set=comb_category hide=1]
-        [value name=qmenu_toplevel_field set=prod_group hide=1]
-        [value name=qmenu_sublevel_field set=category hide=1]
+[if !cgi qmenu_products]
+        [cgi name=qmenu_products set=products hide=1]
+        [cgi name=qmenu_comb_field set=comb_category hide=1]
+        [cgi name=qmenu_toplevel_field set=prod_group hide=1]
+        [cgi name=qmenu_sublevel_field set=category hide=1]
 [/if]
 		<select name="qmenu_products"
         		onChange="
@@ -448,34 +460,34 @@
             				);
         			"
 		size=1 style="width:130px;">
-			[loop list="[list-databases]" option=qmenu_products]
+			[loop list="[list-databases]" option=qmenu_products cgi=1]
 			<OPTION VALUE="[loop-code]">[loop-code]</OPTION>
 			[/loop]
 		</select> <input type=submit value=Go><br>
-<div id=combfield style="visibility:Visible;">
+<div id=combfield style="visibility:[if cgi qmenu_use_comb_field]Visible[else]Hidden[/else][/if];">
 		<select name="qmenu_comb_field" style="width:130px;">
 			<option value=""> -- none --
-			[loop list="[db-columns table='[value qmenu_products]']" option=qmenu_comb_field]
+			[loop list="[db-columns table='[cgi qmenu_products]']" option=qmenu_comb_field cgi=1]
 			<option>[loop-code]
 			[/loop]
-		</select> Comb_Field containing category info (Default: comb_category)
+		</select> Field (Default: comb_category)
 </div>
-<div id=nocombfield style="visibility:Hidden;">
+<div id=nocombfield style="visibility:[if cgi qmenu_use_comb_field]Hidden[else]Visible[/else][/if];">
 		<select name="qmenu_toplevel_field" style="width:130px;">
 			<option value=""> -- none --
-			[loop list="[db-columns table='[value qmenu_products]']" option=qmenu_toplevel_field]
+			[loop list="[db-columns table='[cgi qmenu_products]']" option=qmenu_toplevel_field cgi=1]
 			<option>[loop-code]
 			[/loop]
 		</select> Top Level Field<br>
 		<select name="qmenu_sublevel_field" style="width:130px;">
 			<option value=""> -- none --
-			[loop list="[db-columns table='[value qmenu_products]']" option=qmenu_sublevel_field]
+			[loop list="[db-columns table='[cgi qmenu_products]']" option=qmenu_sublevel_field cgi=1]
 			<option>[loop-code]
 			[/loop]
 		</select> Sub Level Field
 </div>
-                <input type=checkbox name="qmenu_use_comb_field" value=1 CHECKED onClick="toggle_comb(this.form.qmenu_use_comb_field.checked);"> Use comb_field&nbsp;&nbsp;
-                <input type=checkbox name="qmenu_even_large" value=1> Override, build even if large &nbsp;
+                <input type=checkbox name="qmenu_use_comb_field" value=1 onClick="toggle_comb(this.form.qmenu_use_comb_field.checked);" [checked name=qmenu_use_comb_field value=1 cgi=1]> Use comb_field&nbsp;&nbsp;
+                <input type=checkbox name="qmenu_even_large" value=1  [checked name=qmenu_even_large value=1 cgi=1]> Override, build even if large &nbsp;
                 </form>
 [/tabbed-panel]
 [tabbed-panel Top&Sub Level Tables]
@@ -484,14 +496,40 @@
                 <input type=hidden name=mv_action value="back">
                 <input type=hidden name=qmenu_cat value=1>
 
-                <select name=qmenu_toplevel>
-                [loop list="area [list-databases]" option=qmenu_toplevel cgi=1]
-                <option> [loop-code][/loop]
-                </select> Top Level table (Default: area)<br>
-                <select name=qmenu_sublevel>
-                [loop list="cat [list-databases]" option=qmenu_sublevel cgi=1]
-                <option> [loop-code][/loop]
-                </select> Sub Level table (Default: cat)<br>
+				<table style="font-size: 10px">
+					<tr>
+						<td>
+					<select name=qmenu_toplevel>
+					[loop list="area [list-databases]" option=qmenu_toplevel cgi=1]
+					<option> [loop-code][/loop]
+					</select>
+						</td>
+						<td>
+					Top Level table (Default: area)
+						</td>
+					</tr>
+					<tr>
+						<td>
+					<select name=qmenu_sublevel>
+					[loop list="cat [list-databases]" option=qmenu_sublevel cgi=1]
+					<option> [loop-code][/loop]
+					</select>
+						</td>
+						<td>
+					Sub Level table (Default: cat)
+						</td>
+					</tr>
+					<tr>
+						<td>
+					[display type=select name=qmenu_sel_value
+							 lookup_query="select distinct sel from area"
+							 options="=none" cgi=1]
+						</td>
+						<td>
+					Selector (if any)
+						</td>
+					</tr>
+				</table>
                 <input type=checkbox name="qmenu_even_large" value=1> Override, build even if large &nbsp;
                 <input type=submit value=Go>
                 </form>
@@ -499,7 +537,6 @@
 [/tabbed-display]
 	</td>
 </tr>
-</table>
 
 <script language="JavaScript1.2">
 	var lines = new Array;
@@ -515,6 +552,15 @@
 	var ltitle = new Array;
 	var emodes;
 	var evalues;
+	var image_dir = '[image dir-only=1 ui=1 secure="__UI_SECURE__"]';
+	var empty_img    = image_dir + 'box_empty.gif';
+	var up_img       = image_dir + 'up.gif';
+	var down_img     = image_dir + 'down.gif';
+	var full_img     = image_dir + 'box_checked.gif';
+	var left_img     = image_dir + 'left.gif';
+	var right_img    = image_dir + 'right.gif';
+	var forward_img  = image_dir + 'forward.gif';
+	var transfer_img = image_dir + 'transfer.gif';
 
 [perl reparse=0]
 	my @out;
@@ -650,6 +696,7 @@
 	return;
 [/calc]
 
+
 	var is_form_changed = 0;
 	var checkcur = 0;
 	var form;
@@ -743,8 +790,6 @@
 	function checkit(idx) {
 		var nam = 'img' + idx;
 		var i_el = document.getElementById(nam);
-		var empty_img = '[image dir-only=1 ui=1 secure="__UI_SECURE__"]box_empty.gif';
-		var full_img = '[image dir-only=1 ui=1 secure="__UI_SECURE__"]box_checked.gif';
 		var l = lines[idx];
 
 		if(l != undefined && l[CHECK] == 1) {
@@ -954,10 +999,10 @@
 			// out =	idx + 
 			out = ' <a href="javascript:checkit(' + idx + ');void(0)"><img ';
 			if(l[CHECK] == 1) {
-				out = out + 'src="__UI_IMG__box_checked.gif" ';
+				out = out + 'src="' + checked_img + '" ';
 			}
 			else {
-				out = out + 'src="__UI_IMG__box_empty.gif" ';
+				out = out + 'src="' + empty_img + '" ';
 			}
 
 			var grp = l[MSORT] + '';
@@ -968,11 +1013,11 @@
 			out = out + 'border=0 align=absbottom ' +
 					'id="img' + idx + '"></A>' + "\n" +
 					'<a href="javascript:motion(' + idx + ", 'left');void(0)" +
-					'"><img src="__UI_IMG__left.gif" border=0 align=absbottom></A>' + "\n" +
+					'"><img src="' + left_img + '" border=0 align=absbottom></A>' + "\n" +
 					'<a href="javascript:motion(' + idx + ", 'right');void(0)" +
-					'"><img src="__UI_IMG__right.gif" border=0 align=absbottom></A>' + "\n" +
+					'"><img src="' + right_img + '" border=0 align=absbottom></A>' + "\n" +
 					'<a href="javascript:loadForm(' + idx + ");void(0)" +
-					'"><img src="__UI_IMG__forward.gif" border=0 align=absbottom></A>' + "\n";
+					'"><img src="' + forward_img + '" border=0 align=absbottom></A>' + "\n";
 			for(i = 0; i < l[MSORT]; i++)
 				out = out + '&nbsp;&nbsp;&nbsp;'; 
 			if(showlevel == 1 && l[MSORT] > 0) {
@@ -1029,10 +1074,10 @@
 			// out =	idx + 
 			out = ' <a href="javascript:checkit(' + idx + ');void(0)"><img ';
 			if(l[CHECK] == 1) {
-				out = out + 'src="__UI_IMG__box_checked.gif" ';
+				out = out + 'src="' + checked_img + '" ';
 			}
 			else {
-				out = out + 'src="__UI_IMG__box_empty.gif" ';
+				out = out + 'src="' + empty_img + '" ';
 			}
 
 			var linktitle = '';
@@ -1045,11 +1090,11 @@
 			out = out + 'border=0 align=absbottom ' +
 					'id="img' + idx + '"></A>' + "\n" +
 					'<a href="javascript:motion(' + idx + ", 'up');void(0)" +
-					'"><img src="__UI_IMG__up.gif" border=0 align=absbottom></A>' + "\n" +
+					'"><img src="' + up_img + '" border=0 align=absbottom></A>' + "\n" +
 					'<a href="javascript:motion(' + idx + ", 'down');void(0)" +
-					'"><img src="__UI_IMG__down.gif" border=0 align=absbottom></A>' + "\n" +
+					'"><img src="' + down_img + '" border=0 align=absbottom></A>' + "\n" +
 					'<a href="javascript:loadForm(' + idx + ");void(0)" +
-					'"><img src="__UI_IMG__transfer.gif" border=0 align=absbottom></A>' + "\n";
+					'"><img src="' + transfer_img + '" border=0 align=absbottom></A>' + "\n";
 
 			var nme = l[NAME];
 			if(nme.length > 30) {
@@ -1631,17 +1676,14 @@
 
 </script>
 [/restrict]
-
-<form name=qmenuform action="[process href=@@MV_PAGE@@]" method=POST>
-<input name=mv_session_id type=hidden value="[data session id]">
-<input name=mv_action type=hidden value="back">
-<input name=cancelsubmit type=hidden value="">
-<input name=qmenu_name type=hidden value="[scratch qmenu_name]">
-<input name=qmenu_text type=hidden value="">
-
-<table>
 <tr>
-	<td>
+<form name=qmenuform action="[process href=@@MV_PAGE@@]" method=POST>
+	<td colspan=2>
+		<input name=mv_session_id type=hidden value="[data session id]">
+		<input name=mv_action type=hidden value="back">
+		<input name=cancelsubmit type=hidden value="">
+		<input name=qmenu_name type=hidden value="[scratch qmenu_name]">
+		<input name=qmenu_text type=hidden value="">
 Save to new menu <input name=qmenu_new type=text size=20 value="[cgi qmenu_new]">
 		<input type=submit
 				style="Visibility: Hidden;"