Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1180)
+++ branches/2.8.x/CHANGELOG	(revision 1181)
@@ -11,9 +11,17 @@
 ! = Update/Change
 
 ------------------------------------- 2.8.1 -------------------------------------
+24-Nov-2009 Dietmar Woellbrink (Luisehahne)
++	add register_frontend_modfiles('jquery'); adds jquery basis scripts in head
++	add register_frontend_modfiles_body('jquery'); adds jquery basis scripts before body end
++	add jquery_theme.js to choose a ui theme, basis is loaded, can be change 
+24-Nov-2009 Dietmar Woellbrink (Luisehahne)
++	add a child page is cumbersome when the parent dropdown list gets to be too large. (Ticket #821)
+24-Nov-2009 Dietmar Woellbrink (Luisehahne)
+!	validate captcha control
 13-Oct-2009 Ruud Eisinga
 #	fixed breaking droplets by highlighting search-words in search result pages.
-13-Oct-2009 Dietmar Woellbrink
+13-Oct-2009 Dietmar Woellbrink (Luisehahne)
 +	added forgotten jquery-fancybox.js Version 1.0
 13-Oct-2009 Dietrich Roland Pehlke (Aldus)
 #	Fixed typo in the finnish language file (ticket #814).
Index: branches/2.8.x/wb/include/jquery/jquery_theme.js
===================================================================
--- branches/2.8.x/wb/include/jquery/jquery_theme.js	(nonexistent)
+++ branches/2.8.x/wb/include/jquery/jquery_theme.js	(revision 1181)
@@ -0,0 +1,6 @@
+var JQUERY_THEME = WB_URL+'/include/jquery/plugins';
+
+$(document).ready(function() {
+        $.insert(JQUERY_THEME+'/jquery-ui.css');
+      /*   $.insert(JQUERY_THEME+'/ui.theme.css');  */
+});
Index: branches/2.8.x/wb/framework/frontend.functions.php
===================================================================
--- branches/2.8.x/wb/framework/frontend.functions.php	(revision 1180)
+++ branches/2.8.x/wb/framework/frontend.functions.php	(revision 1181)
@@ -50,7 +50,7 @@
 $include_head_link_css = '';
 $include_body_links = '';
 $include_head_links = '';
-
+// workout to included frontend.css, fronten.js and frontend_body.js in snippets
 $query="SELECT directory FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'snippet'";
 $query_result=$database->query($query);
 if ($query_result->numRows()>0) {
@@ -105,11 +105,11 @@
 	// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses
 	// we have to cut <pre> and <code> as well.
 	// for HTML-Tags use <(?:[^<]|<.*>)*> which will match strings like <input ... value="<b>value</b>" >
-	$matches = preg_split("~(\[\[.*\]\]|<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
+	$matches = preg_split("~(\[\[.*\]\]|<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
 	if(is_array($matches) && $matches != array()) {
 		$foo = "";
 		foreach($matches as $match) {
-			if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match) && !preg_match('~\[\[.*\]\]~', $match)) {
+			if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match) && !preg_match('~\[\[.*\]\]~', $match)) {
 				$match = str_replace(array('&lt;', '&gt;', '&amp;', '&quot;', '&#039;', '&nbsp;'), array('<', '>', '&', '"', '\'', "\xC2\xA0"), $match);
 				$match = preg_replace('~('.$string.')~ui', '_span class=_highlight__$1_/span_',$match);
 				$match = str_replace(array('&', '<', '>', '"', '\'', "\xC2\xA0"), array('&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '&nbsp;'), $match);
@@ -206,8 +206,17 @@
 		// Make sure block is numeric
 		if(!is_numeric($block)) { $block = 1; }
 		// Include page content
-		if(!defined('PAGE_CONTENT') OR $block!=1) {
+		if(!defined('PAGE_CONTENT') OR $block!=1)
+        {
 			$page_id=$wb->page_id;
+            // set session variable to save page_id only if PAGE_CONTENT is empty
+            $_SESSION['PAGE_ID'] = !isset($_SESSION['PAGE_ID']) ? $page_id : $_SESSION['PAGE_ID'];
+            // set to new value if page_id changed and not 0
+            if(($page_id != 0) AND ($_SESSION['PAGE_ID'] <> $page_id))
+            {
+            $_SESSION['PAGE_ID'] = $page_id;
+            }
+
 			// First get all sections for this page
 			$query_sections = $database->query("SELECT section_id,module,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
 			// If none were found, check if default content is supposed to be shown
@@ -290,13 +299,9 @@
 					$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
 					$page=$query_menu->fetchRow();
 					if ($links==true AND $temp!=$page_id)
-                    {
 						print '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
-                    }
 					else
-                    {
-					    print '<span>'.$page['menu_title'].'</span>';
-                    }
+					    print '<span class="crumb">'.$page['menu_title'].'</span>';
 		        }
 	            $counter++;
 			}
@@ -356,66 +361,111 @@
 	}
 }
 
+function bind_jquery ($file_id='jquery')
+{
+        $jquery_links = '';
+		/* include the Javascript jquery api  */
+		if( $file_id == 'jquery' AND file_exists(WB_PATH .'/include/jquery/jquery-min.js'))
+        {
+            $wbpath = str_replace('\\','/',WB_PATH);  // fixed localhost problem with ie
+			$jquery_links .= "<script type=\"text/javascript\">\n"
+                ."var URL = '".WB_URL."';\n"
+                ."var WB_PATH = '".$wbpath."';\n"
+                ."var WB_URL = '".WB_URL."';\n"
+                ."var TEMPLATE_DIR = '".TEMPLATE_DIR."';\n"
+                ."</script>\n";
+
+			$jquery_links .= '<script src="'.WB_URL.'/include/jquery/jquery-min.js" type="text/javascript"></script>'."\n";
+			$jquery_links .= '<script src="'.WB_URL.'/include/jquery/jquery-ui-min.js" type="text/javascript"></script>'."\n";
+			$jquery_links .= '<script src="'.WB_URL.'/include/jquery/jquery-insert.js" type="text/javascript"></script>'."\n";
+            /* workout to insert ui.css and theme */
+            $jquery_theme =  WB_PATH.'/modules/jquery/jquery_theme.js';
+			$jquery_links .=  file_exists($jquery_theme)
+                ? '<script src="'.WB_URL.'/modules/jquery/jquery_theme.js" type="text/javascript"></script>'."\n"
+                : '<script src="'.WB_URL.'/include/jquery/jquery_theme.js" type="text/javascript"></script>'."\n";
+            /* workout to insert plugins functions, set in templatedir */
+            $jquery_frontend_file = TEMPLATE_DIR.'/jquery_frontend.js';
+			$jquery_links .= file_exists(str_replace( WB_URL, WB_PATH, $jquery_frontend_file))
+                ? '<script src="'.$jquery_frontend_file.'" type="text/javascript"></script>'."\n"
+                : '';
+		}
+    return $jquery_links;
+}
+
+
 // Function to add optional module Javascript into the <body> section of the frontend
-if(!function_exists('register_frontend_modfiles_body')) {
-	function register_frontend_modfiles_body($file_id="js") {
+if(!function_exists('register_frontend_modfiles_body'))
+{
+	function register_frontend_modfiles_body($file_id="js")
+    {
 		// sanity check of parameter passed to the function
 		$file_id = strtolower($file_id);
-		if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js") {
+		if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js" && $file_id !== "jquery")
+        {
 			return;
 		}
 
+       // define constant indicating that the register_frontent_files was invoked
+       if(!defined('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED', true);
 		global $wb, $database, $include_body_links;
 		// define default baselink and filename for optional module javascript files
 		$body_links = "";
-		$base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend_body.js" type="text/javascript"></script>';
-		$base_file = "frontend_body.js";
 
-		if(!empty($include_body_links)) {
-			if(strpos($body_links, $include_body_links) === false) {
-				$body_links .= $include_body_links;
-			}
-			$include_body_links = '';
-		}
+		/* include the Javascript jquery api  */
+        $body_links .= bind_jquery($file_id);
 
-		// gather information for all models embedded on actual page
-		$page_id = $wb->page_id;
-		$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
-				WHERE page_id=$page_id AND module<>'wysiwyg'");
+		if($file_id !== "css" && $file_id == "js" && $file_id !== "jquery")
+        {
+    		$base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend_body.js" type="text/javascript"></script>';
+    		$base_file = "frontend_body.js";
 
-		while($row = $query_modules->fetchRow()) {
-			// check if page module directory contains a frontend_body.js file
-			if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
-					// create link with frontend_body.js source for the current module
-				$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
+			// ensure that frontend_body.js is only added once per module type
+    		if(!empty($include_body_links))
+            {
+    			if(strpos($body_links, $include_body_links) === false)
+                {
+    				$body_links .= $include_body_links;
+    			}
+    			$include_body_links = '';
+    		}
 
-				// define constant indicating that the register_frontent_files was invoked
-					if(!defined('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED', true);
+    		// gather information for all models embedded on actual page
+    		$page_id = $wb->page_id;
+    		$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
+    				WHERE page_id=$page_id AND module<>'wysiwyg'");
 
-				// ensure that frontend_body.js is only added once per module type
-				if(strpos($body_links, $tmp_link) === false) {
-					$body_links .= $tmp_link ."\n";
-				}
-			};
-		}
+    		while($row = $query_modules->fetchRow())
+            {
+    			// check if page module directory contains a frontend_body.js file
+    			if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
+    			// create link with frontend_body.js source for the current module
+    				$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
 
-		/* include the Javascript email protection function
-		if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js')) {
-			$body_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/droplets/js/mdcr.js"></script>'."\n";
-		} elseif( $file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) {
-			$body_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>'."\n";
-		} */
-		echo $body_links;
+    				// define constant indicating that the register_frontent_files_body was invoked
+    					if(!defined('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED', true);
+
+    				// ensure that frontend_body.js is only added once per module type
+    				if(strpos($body_links, $tmp_link) === false) {
+    					$body_links .= $tmp_link;
+    				}
+    			}
+    		}
+        }
+
+		print $body_links."\n"; ;
 	}
 }
 
 
 // Function to add optional module Javascript or CSS stylesheets into the <head> section of the frontend
-if(!function_exists('register_frontend_modfiles')) {
-	function register_frontend_modfiles($file_id="css") {
+if(!function_exists('register_frontend_modfiles'))
+{
+	function register_frontend_modfiles($file_id="css")
+    {
 		// sanity check of parameter passed to the function
 		$file_id = strtolower($file_id);
-		if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js") {
+		if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js" && $file_id !== "jquery")
+        {
 			return;
 		}
 
@@ -423,13 +473,32 @@
 		// define default baselink and filename for optional module javascript and stylesheet files
 		$head_links = "";
 
-		if($file_id == "css") {
+        switch ($file_id)
+        {
+            case 'css':
 			$base_link = '<link href="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.css"';
 			$base_link.= ' rel="stylesheet" type="text/css" media="screen" />';
 			$base_file = "frontend.css";
-		} else {
+    		if(!empty($include_head_link_css))
+            {
+              $head_links .=  !strpos($head_links, $include_head_link_css) ? $include_head_link_css : '';
+              $include_head_link_css = '';
+            }
+            break;
+            case 'jquery':
+            $head_links .= bind_jquery($file_id);
+            break;
+            case 'js':
 			$base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.js" type="text/javascript"></script>';
 			$base_file = "frontend.js";
+    		if(!empty($include_head_links))
+            {
+              $head_links .= !strpos($head_links, $include_head_links) ? $include_head_links : '';
+              $include_head_links = '';
+            }
+            break;
+            default:
+            break;
 		}
 
 		if(!empty($include_head_link_css)) {
@@ -446,38 +515,49 @@
 			}
 		}
 
-		// gather information for all models embedded on actual page
-		$page_id = $wb->page_id;
-		$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections 
-				WHERE page_id=$page_id AND module<>'wysiwyg'");
+        if( $file_id != 'jquery')
+        {
 
-		while($row = $query_modules->fetchRow()) {
-			// check if page module directory contains a frontend.js or frontend.css file
-			if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
-					// create link with frontend.js or frontend.css source for the current module
-				$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
+    		// gather information for all models embedded on actual page
+    		$page_id = $wb->page_id;
+    		$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
+    				WHERE page_id=$page_id AND module<>'wysiwyg'");
 
-				// define constant indicating that the register_frontent_files was invoked
-				if($file_id == 'css') {
-					if(!defined('MOD_FRONTEND_CSS_REGISTERED')) define('MOD_FRONTEND_CSS_REGISTERED', true);
-				} else {
-					if(!defined('MOD_FRONTEND_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_JAVASCRIPT_REGISTERED', true);
-				}
-				// ensure that frontend.js or frontend.css is only added once per module type
-				if(strpos($head_links, $tmp_link) === false) {
-					$head_links .= $tmp_link ."\n";
-				}
-			};
-		}
+    		while($row = $query_modules->fetchRow())
+            {
+    			// check if page module directory contains a frontend.js or frontend.css file
+    			if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
+                {
+    			// create link with frontend.js or frontend.css source for the current module
+    				$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
 
-		// include the Javascript email protection function
-		if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js')) {
-			$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/droplets/js/mdcr.js"></script>'."\n";
-		} elseif( $file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) {
-			$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>'."\n";
-		}
-		echo $head_links;
-	}
+    				// define constant indicating that the register_frontent_files was invoked
+    				if($file_id == 'css')
+                    {
+    					if(!defined('MOD_FRONTEND_CSS_REGISTERED')) define('MOD_FRONTEND_CSS_REGISTERED', true);
+    				} else
+                    {
+    					if(!defined('MOD_FRONTEND_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_JAVASCRIPT_REGISTERED', true);
+    				}
+    				// ensure that frontend.js or frontend.css is only added once per module type
+    				if(strpos($head_links, $tmp_link) === false)
+                    {
+    					$head_links .= $tmp_link."\n";
+    				}
+    			};
+    		}
+        		// include the Javascript email protection function
+        		if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js'))
+                {
+        			$head_links .= '<script src="'.WB_URL.'/modules/droplets/js/mdcr.js" type="text/javascript"></script>'."\n";
+        		}
+                elseif( $file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js'))
+                {
+        			$head_links .= '<script src="'.WB_URL.'/modules/output_filter/js/mdcr.js" type="text/javascript"></script>'."\n";
+        		}
+        }
+        print $head_links;
+    }
 }
 
 // Begin WB < 2.4.x template compatibility code
