Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 871)
+++ trunk/CHANGELOG	(revision 872)
@@ -12,16 +12,17 @@
 
 ------------------------------------- 2.7.1 -------------------------------------
 01-Nov-2008 Thomas Hornik
-! improved ext_charset to work with latin1,cp1252,cp1251,latin2,hebrew,greek,latin5,latin7,utf8
-+ added config for section anchor. ATTN: add "INSERT INTO TABLE_PREFIX.'settings' (name,value,extra) VALUES ('sec_anchor', 'wb_', '')" to upgrade-script.
+!	improved ext_charset to work with latin1,cp1252,cp1251,latin2,hebrew,greek,latin5,latin7,utf8
++	added config for section anchor. ATTN: add "INSERT INTO TABLE_PREFIX.'settings' (name,value,extra) VALUES ('sec_anchor', 'wb_', '')" to upgrade-script.
+!	updated menulink and search to use configureable section-anchor
 29-Oct-2008 Thomas Hornik
 # News: total number of news wasn't calculated correctly
-! Captcha: removed IFRAME for Calculation-as-text captcha
-- removed useless init_utf8funcs()-function
-+ search: added search_lang for use in search-form. Using DE, the search will search ä=ae,... (alternate spelling of german umlauts)
-- search: removed undocumented word-boundary search
-! search: search_path is now anchored to the beginning of link ("link LIKE '$path%'" instead of "link LIKE '%$path%'")
-+ search: added key 'ext_charset' to search-extension to query external databases
+!	Captcha: removed IFRAME for Calculation-as-text captcha
+-	removed useless init_utf8funcs()-function
++	search: added search_lang for use in search-form. Using DE, the search will search ä=ae,... (alternate spelling of german umlauts)
+-	search: removed undocumented word-boundary search
+!	search: search_path is now anchored to the beginning of link ("link LIKE '$path%'" instead of "link LIKE '%$path%'")
++	search: added key 'ext_charset' to search-extension to query external databases
 25-Oct-2008 Christian Sommer
 !	updated basic templates according the template guidelines
 24-Oct-2008 Dietrich Roland Pehlke
Index: trunk/wb/search/search_modext.php
===================================================================
--- trunk/wb/search/search_modext.php	(revision 871)
+++ trunk/wb/search/search_modext.php	(revision 872)
@@ -191,6 +191,17 @@
 	elseif(substr($page_link_target,0,13)=='#!wb_section_') {
 		$page_link_target = '#'.substr($page_link_target, 2);
 	}
+	
+	// since wb 2.7.1 the section-anchor is configurable - SEC_ANCHOR holds the anchor name
+	if(substr($page_link_target,0,12)=='#wb_section_') {
+		if(defined('SEC_ANCHOR') && SEC_ANCHOR!='') {
+			$sec_id = substr($page_link_target, 12);
+			$page_link_target = '#'.SEC_ANCHOR.$sec_id;
+		} else { // section-anchors are disabled
+			$page_link_target = '';
+		}
+	}
+	
 	return $page_link_target;
 }
 
Index: trunk/wb/modules/menu_link/modify.php
===================================================================
--- trunk/wb/modules/menu_link/modify.php	(revision 871)
+++ trunk/wb/modules/menu_link/modify.php	(revision 872)
@@ -1,31 +1,31 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2008, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Must include code to stop this file being accessed directly
-if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
+<?php
 
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2008, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Must include code to stop this file being accessed directly
+if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
+
 // check if module language file exists for the language set by the user (e.g. DE, EN)
 if(!file_exists(WB_PATH .'/modules/menu_link/languages/'.LANGUAGE .'.php')) {
 	// no module language file exists for the language set by the user, include default module language file EN.php
@@ -34,101 +34,105 @@
 	// a module language file exists for the language defined by the user, load it
 	require_once(WB_PATH .'/modules/menu_link/languages/'.LANGUAGE .'.php');
 }
-
-// get target page_id
-$table = TABLE_PREFIX.'mod_menu_link';
-$sql_result = $database->query("SELECT * FROM $table WHERE section_id = '$section_id'");
-$sql_row = $sql_result->fetchRow();
+
+// get target page_id
+$table = TABLE_PREFIX.'mod_menu_link';
+$sql_result = $database->query("SELECT * FROM $table WHERE section_id = '$section_id'");
+$sql_row = $sql_result->fetchRow();
 $target_page_id = $sql_row['target_page_id'];
-$extern = $sql_row['extern'];
-$anchor = $sql_row['anchor'];
-$sel = ' selected';
-
-// Get list of all visible pages, except actual one
-$links = array();
-$table_p = TABLE_PREFIX."pages";
-if($query_page = $database->query("SELECT * FROM $table_p WHERE parent = '0' ORDER BY position")) {
+$extern = $sql_row['extern'];
+$anchor = $sql_row['anchor'];
+$sel = ' selected';
+
+// Get list of all visible pages, except actual one
+$links = array();
+$table_p = TABLE_PREFIX."pages";
+if($query_page = $database->query("SELECT * FROM $table_p WHERE parent = '0' ORDER BY position")) {
 	while($page = $query_page->fetchRow()) {
 		$all_links[$page['page_id']]='/'.$page['menu_title'];
-		if($admin->page_is_visible($page) && $page['page_id']!=$page_id) {
+		if($admin->page_is_visible($page) && $page['page_id']!=$page_id) {
 			$links[$page['page_id']]='/'.$page['menu_title'];
-		}
-		if($query_subpage = $database->query("SELECT * FROM $table_p WHERE page_id != '$page_id' AND root_parent = '{$page['page_id']}' ORDER BY level")) {
-			while($sub = $query_subpage->fetchRow()) {
-				if($admin->page_is_visible($sub)) {
-					$parent_link = (array_key_exists($sub['parent'],$all_links))?$all_links[$sub['parent']]:"";
-					$links[$sub['page_id']]=$parent_link.'/'.$sub['menu_title'];
-				}
-			}
-		}
-	}
-}
-// Get list of targets (id=... or <a name ...>) from pages in $links
-$targets = array();
-$table_mw = TABLE_PREFIX."mod_wysiwyg";
-$table_s = TABLE_PREFIX."sections";
-foreach($links as $pid=>$l) {
-	if($query_section = $database->query("SELECT section_id, module FROM $table_s WHERE page_id = '$pid' ORDER BY position")) {
+		}
+		if($query_subpage = $database->query("SELECT * FROM $table_p WHERE page_id != '$page_id' AND root_parent = '{$page['page_id']}' ORDER BY level")) {
+			while($sub = $query_subpage->fetchRow()) {
+				if($admin->page_is_visible($sub)) {
+					$parent_link = (array_key_exists($sub['parent'],$all_links))?$all_links[$sub['parent']]:"";
+					$links[$sub['page_id']]=$parent_link.'/'.$sub['menu_title'];
+				}
+			}
+		}
+	}
+}
+// Get list of targets (id=... or <a name ...>) from pages in $links
+$targets = array();
+$table_mw = TABLE_PREFIX."mod_wysiwyg";
+$table_s = TABLE_PREFIX."sections";
+foreach($links as $pid=>$l) {
+	if($query_section = $database->query("SELECT section_id, module FROM $table_s WHERE page_id = '$pid' ORDER BY position")) {
 		while($section = $query_section->fetchRow()) {
-			// get section-anchor
-			$targets[$pid][] = "wb_section_{$section['section_id']}";
-			if($section['module'] == 'wysiwyg') {
-				if($query_page = $database->query("SELECT content FROM $table_mw WHERE section_id = '{$section['section_id']}' LIMIT 1")) {
-					$page = $query_page->fetchRow();
-					if(preg_match_all('/<(?:[^>]+id|\s*a[^>]+name)\s*=\s*"(.*)"/iuU',$page['content'], $match)) {
-						foreach($match[1] AS $t) {
-							$targets[$pid][] = $t;
-						}
-					}
-				}
-			}
-		}
-	}
-}
-// get target-window for actual page
-$table = TABLE_PREFIX."pages";
-$query_page = $database->query("SELECT target FROM $table WHERE page_id = '$page_id'");
-$page = $query_page->fetchRow();
-$target = $page['target'];
-
-
-// script for target-select-box
-?>
-<script type="text/javascript">
+			// get section-anchor
+			if(defined('SEC_ANCHOR') && SEC_ANCHOR!='') {
+				$targets[$pid][] = SEC_ANCHOR.$section['section_id'];
+			} else {
+				$targets[$pid] = array();
+			}
+			if($section['module'] == 'wysiwyg') {
+				if($query_page = $database->query("SELECT content FROM $table_mw WHERE section_id = '{$section['section_id']}' LIMIT 1")) {
+					$page = $query_page->fetchRow();
+					if(preg_match_all('/<(?:[^>]+id|\s*a[^>]+name)\s*=\s*"(.*)"/iuU',$page['content'], $match)) {
+						foreach($match[1] AS $t) {
+							$targets[$pid][] = $t;
+						}
+					}
+				}
+			}
+		}
+	}
+}
+// get target-window for actual page
+$table = TABLE_PREFIX."pages";
+$query_page = $database->query("SELECT target FROM $table WHERE page_id = '$page_id'");
+$page = $query_page->fetchRow();
+$target = $page['target'];
+
+
+// script for target-select-box
+?>
+<script type="text/javascript">
 	function populate() {
-		o=document.getElementById('page_link');
+		o=document.getElementById('page_link');
 		d=document.getElementById('page_target');
 		e=document.getElementById('extern');
-		if(!d){return;}			
-		var mitems=new Array();
-		mitems['0']=[' ','0'];
-		mitems['-1']=[' ','0'];
-		<?php
-		foreach($links AS $pid=>$link) {
-			$str="mitems['$pid']=[";
-			$str.="' ',";
-			$str.="'0',";
-			if(is_array($targets) && is_array($targets[$pid])) {
-				foreach($targets[$pid] AS $value) {
-					$str.="'#$value',";
-					$str.="'$value',";
-				}
-				$str=rtrim($str, ',');
-				$str.="];\n";
-			}
-			echo $str;
-		}
-		?>
-		d.options.length=0;
-		cur=mitems[o.options[o.selectedIndex].value];
-		if(!cur){return;}
-		d.options.length=cur.length/2;
-		j=0;
-		for(var i=0;i<cur.length;i=i+2)
-		{
-			d.options[j].text=cur[i];
-			d.options[j++].value=cur[i+1];
+		if(!d){return;}			
+		var mitems=new Array();
+		mitems['0']=[' ','0'];
+		mitems['-1']=[' ','0'];
+		<?php
+		foreach($links AS $pid=>$link) {
+			$str="mitems['$pid']=[";
+			$str.="' ',";
+			$str.="'0',";
+			if(is_array($targets) && is_array($targets[$pid])) {
+				foreach($targets[$pid] AS $value) {
+					$str.="'#$value',";
+					$str.="'$value',";
+				}
+				$str=rtrim($str, ',');
+				$str.="];\n";
+			}
+			echo $str;
 		}
+		?>
+		d.options.length=0;
+		cur=mitems[o.options[o.selectedIndex].value];
+		if(!cur){return;}
+		d.options.length=cur.length/2;
+		j=0;
+		for(var i=0;i<cur.length;i=i+2)
+		{
+			d.options[j].text=cur[i];
+			d.options[j++].value=cur[i+1];
+		}
 		
 		if(o.value=='-1') {
 			e.disabled = false;
@@ -136,65 +140,65 @@
 			e.disabled = true;
 		}
 	}
-</script>
-
-<form name="menulink" action="<?php echo WB_URL ?>/modules/menu_link/save.php" method="post">
-<input type="hidden" name="page_id" value="<?php echo $page_id ?>" />
-<input type="hidden" name="section_id" value="<?php echo $section_id ?>" />
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
-<tr>
-	<td>
-		<?php echo $TEXT['LINK'].':' ?>
-	</td>
-	<td>
-		<select name="page_link" id="page_link" onchange="populate()" style="width:250px;" />
+</script>
+
+<form name="menulink" action="<?php echo WB_URL ?>/modules/menu_link/save.php" method="post">
+<input type="hidden" name="page_id" value="<?php echo $page_id ?>" />
+<input type="hidden" name="section_id" value="<?php echo $section_id ?>" />
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+	<td>
+		<?php echo $TEXT['LINK'].':' ?>
+	</td>
+	<td>
+		<select name="page_link" id="page_link" onchange="populate()" style="width:250px;" />
 			<option value="0"<?php echo $target_page_id=='0'?$sel:''?>><?php echo $TEXT['PLEASE_SELECT']; ?></option>
-			<option value="-1"<?php echo $target_page_id=='-1'?$sel:''?>><?php echo $MOD_MENU_LINK['EXTERNAL_LINK']; ?></option>
-			<?php foreach($links AS $pid=>$link) {
-				echo "<option value=\"$pid\" ".($target_page_id==$pid?$sel:'').">$link</option>";
-			} ?>
+			<option value="-1"<?php echo $target_page_id=='-1'?$sel:''?>><?php echo $MOD_MENU_LINK['EXTERNAL_LINK']; ?></option>
+			<?php foreach($links AS $pid=>$link) {
+				echo "<option value=\"$pid\" ".($target_page_id==$pid?$sel:'').">$link</option>";
+			} ?>
 		</select>
 		&nbsp;
-		<input type="text" name="extern" id="extern" value="<?php echo $extern; ?>" style="width:250px;" <?php if($target_page_id!='-1') echo 'disabled="disabled"'; ?> />
-	</td>
-</tr>
-<tr>
-	<td>
-		<?php echo $TEXT['ANCHOR'].':' ?>
-	</td>
-	<td>
-		<select name="page_target" id="page_target" onfocus="populate()" style="width:250px;" />
-			<option value="<?php echo $anchor ?>" selected><?php echo $anchor=='0'?' ':'#'.$anchor ?></option>
-		</select>
-	</td>
-</tr>
-<tr>
-	<td>
-		<?php echo $TEXT['TARGET'].':' ?>
-	</td>
-	<td>
-		<select name="target" style="width:250px;" />
-			<option value="_blank"<?php if($target=='_blank') echo ' selected'; ?>><?php echo $TEXT['NEW_WINDOW'] ?></option>
-			<option value="_self"<?php if($target=='_self') echo ' selected'; ?>><?php echo $TEXT['SAME_WINDOW'] ?></option>
-			<option value="_top"<?php if($target=='_top') echo ' selected'; ?>><?php echo $TEXT['TOP_FRAME'] ?></option>
-		</select>
-	</td>
-</tr>
-</table>
-
-<br />
-
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
-<tr>
-	<td align="left">
-		<input type="submit" value="<?php echo $TEXT['SAVE'] ?>" style="width: 100px; margin-top: 5px;" />
-	</td>
-	<td align="right">
-		</form>
-		<input type="button" value="<?php echo $TEXT['CANCEL'] ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
-	</td>
-</tr>
-</table>
-
-</form>
-
+		<input type="text" name="extern" id="extern" value="<?php echo $extern; ?>" style="width:250px;" <?php if($target_page_id!='-1') echo 'disabled="disabled"'; ?> />
+	</td>
+</tr>
+<tr>
+	<td>
+		<?php echo $TEXT['ANCHOR'].':' ?>
+	</td>
+	<td>
+		<select name="page_target" id="page_target" onfocus="populate()" style="width:250px;" />
+			<option value="<?php echo $anchor ?>" selected><?php echo $anchor=='0'?' ':'#'.$anchor ?></option>
+		</select>
+	</td>
+</tr>
+<tr>
+	<td>
+		<?php echo $TEXT['TARGET'].':' ?>
+	</td>
+	<td>
+		<select name="target" style="width:250px;" />
+			<option value="_blank"<?php if($target=='_blank') echo ' selected'; ?>><?php echo $TEXT['NEW_WINDOW'] ?></option>
+			<option value="_self"<?php if($target=='_self') echo ' selected'; ?>><?php echo $TEXT['SAME_WINDOW'] ?></option>
+			<option value="_top"<?php if($target=='_top') echo ' selected'; ?>><?php echo $TEXT['TOP_FRAME'] ?></option>
+		</select>
+	</td>
+</tr>
+</table>
+
+<br />
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+	<td align="left">
+		<input type="submit" value="<?php echo $TEXT['SAVE'] ?>" style="width: 100px; margin-top: 5px;" />
+	</td>
+	<td align="right">
+		</form>
+		<input type="button" value="<?php echo $TEXT['CANCEL'] ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
+	</td>
+</tr>
+</table>
+
+</form>
+
