Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 800)
+++ trunk/CHANGELOG	(revision 801)
@@ -12,6 +12,7 @@
 
 ------------------------------------- 2.7.0 -------------------------------------
 05-Apr-2008 Christian Sommer
+!	moved functions to edit module CSS files into the WB core to avoid duplication of code
 !	minor layout change
 !	allowed the character "-" to be used in database names
 04-Apr-2008 Thomas Hornik
Index: trunk/wb/framework/module.functions.php
===================================================================
--- trunk/wb/framework/module.functions.php	(nonexistent)
+++ trunk/wb/framework/module.functions.php	(revision 801)
@@ -0,0 +1,118 @@
+<?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
+
+*/
+
+/**
+	This file contains the routines to edit the optional module files: frontend.css and backend.css
+	Mechanism was introduced with WB 2.7 to provide a global solution for all modules
+	To use this function, include this file from your module (e.g. from modify.php)
+	Then simply call the function edit_css('your_module_directory') - thatīs it
+*/
+
+// prevent this file from being accessed directly
+if(!defined('WB_PATH')) die(header('Location: index.php'));  
+
+// this function checks the validity of the specified module directory
+if(!function_exists('check_module_dir')) {
+	function check_module_dir($mod_dir) {
+		// check if module directory is formal correct (only characters: "a-z,0-9,_,-")
+		if(!preg_match('/^[a-z0-9_-]+$/iD', $mod_dir)) return '';
+		// check if the module folder contains the required info.php file
+		return (file_exists(WB_PATH .'/modules/' .$mod_dir .'/info.php')) ? $mod_dir : '';
+	}
+}
+
+// this function checks if the specified optional module file exists
+if (!function_exists('mod_file_exists')) {
+	function mod_file_exists($mod_dir, $mod_file='frontend.css') {
+  	// check if the module file exists
+		return file_exists(WB_PATH .'/modules/' .$mod_dir .'/' .$mod_file);
+	}
+}
+
+// this function displays the "Edit CSS" button in modify.php 
+if (!function_exists('edit_module_css')) {
+	function edit_module_css($mod_dir) {
+		global $page_id, $section_id, $CAP_EDIT_CSS;
+		// check if the required edit_module_css.php file exists
+		if(!file_exists(WB_PATH .'/modules/edit_module_files.php')) return;
+		
+		// check if specified module directory is valid
+		if(check_module_dir($mod_dir) == '') return;
+		
+		// check if frontend.css or backend.css exist
+		$frontend_css = mod_file_exists($mod_dir, 'frontend.css');
+		$backend_css = mod_file_exists($mod_dir, 'backend.css');
+		
+		// output the edit CSS submtin button if required
+		if($frontend_css || $backend_css) {
+			// default text used for the edit CSS routines if not defined in the modules language file
+			if(!isset($CAP_EDIT_CSS)) $CAP_EDIT_CSS	= 'Edit CSS';
+			?>
+			<form name="edit_module_file" action="<?php echo WB_URL .'/modules/edit_module_files.php?page_id='.$page_id;?>" 
+				method="post" style="margin: 0; align:right;">
+				<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
+				<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
+				<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
+				<input type="hidden" name="edit_file" value="<?php echo ($frontend_css) ?'frontend.css' : 'backend.css';?>">
+				<input type="hidden" name="action" value="edit">
+				<input type="submit" value="<?php echo $CAP_EDIT_CSS;?>" class="mod_<?php echo $mod_dir;?>_edit_css">
+			</form>
+			<?php
+    }
+  }
+}
+
+// this function displays a button to toggle between CSS files (invoked from edit_css.php)
+if (!function_exists('toggle_css_file')) {
+	function toggle_css_file($mod_dir, $base_css_file = 'frontend.css') {
+		global $page_id, $section_id;
+		// check if the required edit_module_css.php file exists
+		if(!file_exists(WB_PATH .'/modules/edit_module_files.php')) return;
+
+		// check if specified module directory is valid
+		if(check_module_dir($mod_dir) == '') return;
+
+		// do sanity check of specified css file
+		if(!in_array($base_css_file, array('frontend.css', 'backend.css'))) return;
+		
+		// display button to toggle between the two CSS files: frontend.css, backend.css
+		$toggle_file = ($base_css_file == 'frontend.css') ? 'backend.css' : 'frontend.css';
+		if(mod_file_exists($mod_dir, $toggle_file)) {
+			?>
+			<form name="toggle_module_file" action="<?php echo WB_URL .'/modules/edit_module_files.php?page_id='.$page_id;?>" 
+				method="post" style="margin: 0; align:right;">
+				<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
+				<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
+				<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
+				<input type="hidden" name="edit_file" value="<?php echo $toggle_file; ?>">
+				<input type="hidden" name="action" value="edit">
+				<input type="submit" value="<?php echo ucwords($toggle_file);?>" class="mod_<?php echo $mod_dir;?>_edit_css">
+			</form>
+			<?php
+		}
+  }
+}
+
+?>
\ No newline at end of file
Index: trunk/wb/modules/edit_module_files.php
===================================================================
--- trunk/wb/modules/edit_module_files.php	(nonexistent)
+++ trunk/wb/modules/edit_module_files.php	(revision 801)
@@ -0,0 +1,182 @@
+<?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
+
+*/
+
+/**
+	This file contains the routines to edit the optional module files: frontend.css and backend.css
+	Mechanism was introduced with WB 2.7 to provide a global solution for all modules
+*/
+
+// prevent this file from being accessed directly
+if(!(isset($_POST['page_id']) && isset($_POST['section_id']) && isset($_POST['action']) 
+	&& isset($_POST['mod_dir'])  && isset($_POST['edit_file']))) die(header('Location: index.php')); 
+
+// include configuration file and admin wrapper script
+require('../config.php');
+
+// include the and admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+// leave if the required module.functions.php file does not exist
+if(!file_exists(WB_PATH .'/framework/module.functions.php')) {
+	echo 'Uups, the required file: /framework/module.functions.php is missing - script stopped.';
+	die;
+}
+
+/**
+	DEFINE LANGUAGE DEPENDING OUTPUTS FOR THE EDIT CSS PART
+*/
+$lang_dir = WB_PATH .'/modules/' .$_POST['mod_dir'] .'/languages/';
+if(file_exists($lang_dir .LANGUAGE .'.php')) {
+	// try to include custom language file if exists
+	require_once($lang_dir .LANGUAGE .'.php');
+} elseif(file_exists($lang_dir .'EN.php')) {
+	// try to include default module language file
+	require_once($lang_dir .'EN.php');
+}
+
+// set defaults if output varibles are not set in the languages files
+if(!isset($HEADING_CSS_FILE))	$HEADING_CSS_FILE = 'Actual module file: ';
+if(!isset($TXT_EDIT_CSS_FILE)) $TXT_EDIT_CSS_FILE = 'Edit the CSS definitions in the textarea below.';
+
+// include functions to edit the optional module CSS files (frontend.css, backend.css)
+require_once(WB_PATH .'/framework/module.functions.php');
+
+// check if the module directory is valid
+$mod_dir = check_module_dir($_POST['mod_dir']);
+if($mod_dir == '') {
+	echo 'The specified module directory is invalid - script stopped.';
+	die;
+};
+
+// check if action is: save or edit
+if($_POST['action'] == 'save' && mod_file_exists($mod_dir, $_POST['edit_file'])) {
+	/** 
+		SAVE THE UPDATED CONTENTS TO THE CSS FILE
+	*/
+
+	$css_content = '';
+	if(isset($_POST['css_codepress']) && strlen($_POST['css_codepress']) > 0) {
+		// Javascript is enabled so take contents from hidden field: css_codepress
+		$css_content = stripslashes($_POST['css_codepress']);
+	} elseif(isset($_POST['css_data']) && strlen($_POST['css_data']) > 0) {
+		// Javascript disabled, take contens from textarea: css_data
+		$css_content = stripslashes($_POST['css_data']);
+	}
+
+	$bytes = 0;
+	if ($css_content != '') {
+		// open the module CSS file for writting
+		$mod_file = @fopen(WB_PATH .'/modules/' .$mod_dir .'/' .$_POST['edit_file'], "wb");
+		// write new content to the module CSS file
+		$bytes = @fwrite($mod_file, $css_content);
+		// close the file
+		@fclose($mod_file);
+	}
+
+	// write out status message
+	if($bytes == 0 ) {
+		$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	} else {
+		$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	}
+
+
+} else {
+	/** 
+		MODIFY CONTENTS OF THE CSS FILE VIA TEXT AREA 
+	*/
+	// check if module backend.css file needs to be included into the <body>
+	if((!method_exists($admin, 'register_backend_modfiles') || !isset($_GET['page_id']))
+			&& file_exists(WB_PATH .'/modules/'.$mod_dir.'/backend.css')) {
+		echo '<style type="text/css">';
+		include(WB_PATH .'/modules/' .$mod_dir .'/backend.css');
+		echo "\n</style>\n";
+	}
+
+	// check which module file to edit (frontend.css, backend.css or '')
+	$css_file = (in_array($_POST['edit_file'], array('frontend.css', 'backend.css'))) ? $_POST['edit_file'] : '';
+
+	// display output
+	if($css_file == '') {
+		// no valid module file to edit; display error message and backlink to modify.php
+		echo "<h2>Nothing to edit</h2>";
+		echo "<p>No valid module file exists for this module.</p>";
+		$output  = "<a href=\"#\" onclick=\"javascript: window.location = '";
+		$output .= ADMIN_URL ."/pages/modify.php?page_id=" .$page_id ."'\">back</a>";
+		echo $output;
+	
+	} else {
+		// store content of the module file in variable
+		$css_content = @file_get_contents(WB_PATH .'/modules/' .$mod_dir .'/' .$css_file);
+
+		// make sure that codepress stuff is only used if the framework is available
+		$CODEPRESS['CLASS'] = '';
+		$CODEPRESS['JS'] = '';
+		if(file_exists(WB_PATH .'/include/codepress/codepress.js')) {
+			$CODEPRESS['CLASS'] = 'class="codepress css" ';
+			$CODEPRESS['JS'] = 'onclick="javascript: css_codepress.value = area_codepress.getCode();"';
+		}
+
+		// write out heading
+		echo '<h2>' .$HEADING_CSS_FILE .'"' .$css_file .'"</h2>';
+		// include button to switch between frontend.css and backend.css (only shown if both files exists)
+		toggle_css_file($mod_dir, $css_file); 
+	  echo '<p>' .$TXT_EDIT_CSS_FILE .'</p>';
+
+		// output content of module file to textareas
+	?>
+		<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" style="margin: 0;">
+			<input type="hidden" name="css_codepress" value="" />
+	  	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
+	  	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
+	  	<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
+			<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" />
+	  	<input type="hidden" name="action" value="save">
+
+			<textarea id="area_codepress" name="css_data" <?php echo $CODEPRESS['CLASS'];?>cols="115" rows="25" wrap="VIRTUAL" 
+				style="margin:2px;"><?php echo $css_content; ?></textarea>
+
+  			<table cellpadding="0" cellspacing="0" border="0" width="100%">
+  			<tr>
+    			<td align="left">
+ 				<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>"
+				  <?php echo $CODEPRESS['JS'];?> style="width: 100px; margin-top: 5px;" />
+    			</td>
+  				<td align="right">
+      			<input type="button" value="<?php echo $TEXT['CANCEL']; ?>"
+						onclick="javascript: window.location = '<?php echo ADMIN_URL;?>/pages/modify.php?page_id=<?php echo $page_id; ?>';"
+						style="width: 100px; margin-top: 5px;" />
+  				</td>
+  			</tr>
+  			</table>
+		</form>
+		<?php 
+	}
+}
+
+// Print admin footer
+$admin->print_footer();
+
+?>
\ No newline at end of file
Index: trunk/wb/modules/form/edit_css.php
===================================================================
--- trunk/wb/modules/form/edit_css.php	(revision 800)
+++ trunk/wb/modules/form/edit_css.php	(nonexistent)
@@ -1,162 +0,0 @@
-<?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
-
-*/
-
-// include configuration file and admin wrapper script
-require('../../config.php');
-require(WB_PATH.'/modules/admin.php');
-
-/**
-	DEFINE LANGUAGE DEPENDING OUTPUTS FOR THE EDIT CSS PART
-*/
-$lang_dir = WB_PATH .'/modules/' .$_POST['mod_dir'] .'/languages/';
-if(file_exists($lang_dir .LANGUAGE .'.php')) {
-	// try to include custom language file if exists
-	require_once($lang_dir .LANGUAGE .'.php');
-} elseif(file_exists($lang_dir .'EN.php')) {
-	// try to include default module language file
-	require_once($lang_dir .'EN.php');
-}
-
-// set defaults if output varibles are not set in the languages files
-if(!isset($HEADING_CSS_FILE))	$HEADING_CSS_FILE = 'Actual module file: ';
-if(!isset($TXT_EDIT_CSS_FILE)) $TXT_EDIT_CSS_FILE = 'Edit the CSS definitions in the textarea below.';
-
-// include functions to edit the optional module CSS files (frontend.css, backend.css)
-require_once('css.functions.php');
-
-// check if the module directory is valid
-$mod_dir = check_module_dir($_POST['mod_dir']);
-if($mod_dir == '') die(header('Location: index.php'));
-
-// check if action is: save or edit
-if($_POST['action'] == 'save' && mod_file_exists($mod_dir, $_POST['edit_file'])) {
-	/** 
-		SAVE THE UPDATED CONTENTS TO THE CSS FILE
-	*/
-
-	$css_content = '';
-	if(isset($_POST['css_codepress']) && strlen($_POST['css_codepress']) > 0) {
-		// Javascript is enabled so take contents from hidden field: css_codepress
-		$css_content = stripslashes($_POST['css_codepress']);
-	} elseif(isset($_POST['css_data']) && strlen($_POST['css_data']) > 0) {
-		// Javascript disabled, take contens from textarea: css_data
-		$css_content = stripslashes($_POST['css_data']);
-	}
-
-	$bytes = 0;
-	if ($css_content != '') {
-		// open the module CSS file for writting
-		$mod_file = @fopen(dirname(__FILE__) .'/' .$_POST['edit_file'], "wb");
-		// write new content to the module CSS file
-		$bytes = @fwrite($mod_file, $css_content);
-		// close the file
-		@fclose($mod_file);
-	}
-
-	// write out status message
-	if($bytes == 0 ) {
-		$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-	} else {
-		$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-	}
-
-
-} else {
-	/** 
-		MODIFY CONTENTS OF THE CSS FILE VIA TEXT AREA 
-	*/
-	// check if module backend.css file needs to be included into the <body>
-	if((!method_exists($admin, 'register_backend_modfiles') || !isset($_GET['page_id']))
-			&& file_exists(WB_PATH .'/modules/'.$mod_dir.'/backend.css')) {
-		echo '<style type="text/css">';
-		include(WB_PATH .'/modules/' .$mod_dir .'/backend.css');
-		echo "\n</style>\n";
-	}
-
-	// check which module file to edit (frontend.css, backend.css or '')
-	$css_file = (in_array($_POST['edit_file'], array('frontend.css', 'backend.css'))) ? $_POST['edit_file'] : '';
-
-	// display output
-	if($css_file == '') {
-		// no valid module file to edit; display error message and backlink to modify.php
-		echo "<h2>Nothing to edit</h2>";
-		echo "<p>No valid module file exists for this module.</p>";
-		$output  = "<a href=\"#\" onclick=\"javascript: window.location = '";
-		$output .= ADMIN_URL ."/pages/modify.php?page_id=" .$page_id ."'\">back</a>";
-		echo $output;
-	
-	} else {
-		// store content of the module file in variable
-		$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file);
-
-		// make sure that codepress stuff is only used if the framework is available
-		$CODEPRESS['CLASS'] = '';
-		$CODEPRESS['JS'] = '';
-		if(file_exists(WB_PATH .'/include/codepress/codepress.js')) {
-			$CODEPRESS['CLASS'] = 'class="codepress css" ';
-			$CODEPRESS['JS'] = 'onclick="javascript: css_codepress.value = area_codepress.getCode();"';
-		}
-
-		// write out heading
-		echo '<h2>' .$HEADING_CSS_FILE .'"' .$css_file .'"</h2>';
-		// include button to switch between frontend.css and backend.css (only shown if both files exists)
-		toggle_css_file($mod_dir, $css_file); 
-	  echo '<p>' .$TXT_EDIT_CSS_FILE .'</p>';
-
-		// output content of module file to textareas
-	?>
-		<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" style="margin: 0;">
-			<input type="hidden" name="css_codepress" value="" />
-	  	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-	  	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-	  	<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
-			<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" />
-	  	<input type="hidden" name="action" value="save">
-
-			<textarea id="area_codepress" name="css_data" <?php echo $CODEPRESS['CLASS'];?>cols="115" rows="25" wrap="VIRTUAL" 
-				style="margin:2px;"><?php echo $css_content; ?></textarea>
-
-  			<table cellpadding="0" cellspacing="0" border="0" width="100%">
-  			<tr>
-    			<td align="left">
- 				<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>"
-				  <?php echo $CODEPRESS['JS'];?> style="width: 100px; margin-top: 5px;" />
-    			</td>
-  				<td align="right">
-      			<input type="button" value="<?php echo $TEXT['CANCEL']; ?>"
-						onclick="javascript: window.location = '<?php echo ADMIN_URL;?>/pages/modify.php?page_id=<?php echo $page_id; ?>';"
-						style="width: 100px; margin-top: 5px;" />
-  				</td>
-  			</tr>
-  			</table>
-		</form>
-		<?php 
-	}
-}
-
-// Print admin footer
-$admin->print_footer();
-
-?>
\ No newline at end of file

Property changes on: trunk/wb/modules/form/edit_css.php
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: trunk/wb/modules/form/css.functions.php
===================================================================
--- trunk/wb/modules/form/css.functions.php	(revision 800)
+++ trunk/wb/modules/form/css.functions.php	(nonexistent)
@@ -1,105 +0,0 @@
-<?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
-
-*/
-
-// prevent this file from being accessed directly
-if(!defined('WB_PATH')) die(header('Location: index.php'));  
-
-// this function checks the validity of the specified module directory
-if(!function_exists('check_module_dir')) {
-	function check_module_dir($mod_dir) {
-		// check if module directory is formal correct (only characters: "a-z,0-9,_,-")
-		if(!preg_match('/^[a-z0-9_-]+$/iD', $mod_dir)) return '';
-		// check if the module folder contains the required info.php file
-		return (file_exists(WB_PATH .'/modules/' .$mod_dir .'/info.php')) ? $mod_dir : '';
-	}
-}
-
-// this function checks if the specified optional module file exists
-if (!function_exists('mod_file_exists')) {
-	function mod_file_exists($mod_dir, $mod_file='frontend.css') {
-  	// check if the module file exists
-		return file_exists(WB_PATH .'/modules/' .$mod_dir .'/' .$mod_file);
-	}
-}
-
-// this function displays the "Edit CSS" button in modify.php 
-if (!function_exists('css_edit')) {
-	function css_edit($mod_dir) {
-		global $page_id, $section_id, $CAP_EDIT_CSS;
-		// check if specified module directory is valid
-		if(check_module_dir($mod_dir) == '') return;
-		
-		// check if frontend.css or backend.css exist
-		$frontend_css = mod_file_exists($mod_dir, 'frontend.css');
-		$backend_css = mod_file_exists($mod_dir, 'backend.css');
-		
-		// output the edit CSS submtin button if required
-		if($frontend_css || $backend_css) {
-			// default text used for the edit CSS routines if not defined in the modules language file
-			if(!isset($CAP_EDIT_CSS)) $CAP_EDIT_CSS	= 'Edit CSS';
-			?>
-			<form name="edit_module_file" action="<?php echo WB_URL .'/modules/' .$mod_dir .
- 				'/edit_css.php?page_id='.$page_id;?>" method="post" style="margin: 0; align:right;">
-				<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-				<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-				<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
-				<input type="hidden" name="edit_file" value="<?php echo ($frontend_css) ?'frontend.css' : 'backend.css';?>">
-				<input type="hidden" name="action" value="edit">
-				<input type="submit" value="<?php echo $CAP_EDIT_CSS;?>" class="mod_<?php echo $mod_dir;?>_edit_css">
-			</form>
-			<?php
-    }
-  }
-}
-
-// this function displays a button to toggle between CSS files (invoked from edit_css.php)
-if (!function_exists('toggle_css_file')) {
-	function toggle_css_file($mod_dir, $base_css_file = 'frontend.css') {
-		global $page_id, $section_id;
-		// check if specified module directory is valid
-		if(check_module_dir($mod_dir) == '') return;
-
-		// do sanity check of specified css file
-		if(!in_array($base_css_file, array('frontend.css', 'backend.css'))) return;
-		
-		// display button to toggle between the two CSS files: frontend.css, backend.css
-		$toggle_file = ($base_css_file == 'frontend.css') ? 'backend.css' : 'frontend.css';
-		if(mod_file_exists($mod_dir, $toggle_file)) {
-			?>
-			<form name="toggle_module_file" action="<?php echo WB_URL .'/modules/' .$mod_dir .
-				'/edit_css.php?page_id='.$page_id;?>" method="post" style="margin: 0; align:right;">
-				<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-				<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-				<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
-				<input type="hidden" name="edit_file" value="<?php echo $toggle_file; ?>">
-				<input type="hidden" name="action" value="edit">
-				<input type="submit" value="<?php echo ucwords($toggle_file);?>" class="mod_<?php echo $mod_dir;?>_edit_css">
-			</form>
-			<?php
-		}
-  }
-}
-
-?>
\ No newline at end of file

Property changes on: trunk/wb/modules/form/css.functions.php
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: trunk/wb/modules/form/modify_settings.php
===================================================================
--- trunk/wb/modules/form/modify_settings.php	(revision 800)
+++ trunk/wb/modules/form/modify_settings.php	(revision 801)
@@ -33,8 +33,8 @@
 // Include WB admin wrapper script
 require(WB_PATH.'/modules/admin.php');
 
-// include functions to edit the optional module CSS files (frontend.css, backend.css)
-require_once('css.functions.php');
+// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
+@include_once(WB_PATH .'/framework/module.functions.php');
 
 // check if module language file exists for the language set by the user (e.g. DE, EN)
 if(!file_exists(WB_PATH .'/modules/form/languages/'.LANGUAGE .'.php')) {
@@ -63,10 +63,12 @@
 ?>
 <h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
 <?php
-	// include the button to edit the optional module CSS files
-	// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
-	// Place this call outside of any <form></form> construct!!!
-	css_edit('form');
+// include the button to edit the optional module CSS files
+// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
+// Place this call outside of any <form></form> construct!!!
+if(function_exists('edit_module_css')) {
+	edit_module_css('form');
+}
 ?>
 
 <form name="edit" action="<?php echo WB_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;">
Index: trunk/wb/modules/news/edit_css.php
===================================================================
--- trunk/wb/modules/news/edit_css.php	(revision 800)
+++ trunk/wb/modules/news/edit_css.php	(nonexistent)
@@ -1,159 +0,0 @@
-<?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
-
-*/
-
-// include configuration file and admin wrapper script
-require('../../config.php');
-require(WB_PATH.'/modules/admin.php');
-
-/**
-	DEFINE LANGUAGE DEPENDING OUTPUTS FOR THE EDIT CSS PART
-*/
-$lang_dir = WB_PATH .'/modules/' .$_POST['mod_dir'] .'/languages/';
-if(file_exists($lang_dir .LANGUAGE .'.php')) {
-	// try to include custom language file if exists
-	require_once($lang_dir .LANGUAGE .'.php');
-} elseif(file_exists($lang_dir .'EN.php')) {
-	// try to include default module language file
-	require_once($lang_dir .'EN.php');
-}
-
-// set defaults if output varibles are not set in the languages files
-if(!isset($HEADING_CSS_FILE))	$HEADING_CSS_FILE = 'Actual module file: ';
-if(!isset($TXT_EDIT_CSS_FILE)) $TXT_EDIT_CSS_FILE = 'Edit the CSS definitions in the textarea below.';
-
-// include functions to edit the optional module CSS files (frontend.css, backend.css)
-require_once('css.functions.php');
-
-// check if the module directory is valid
-$mod_dir = check_module_dir($_POST['mod_dir']);
-if($mod_dir == '') die(header('Location: index.php'));
-
-// check if action is: save or edit
-if($_POST['action'] == 'save' && mod_file_exists($mod_dir, $_POST['edit_file'])) {
-	/** 
-		SAVE THE UPDATED CONTENTS TO THE CSS FILE
-	*/
-	$css_content = '';
-	if(isset($_POST['css_codepress']) && strlen($_POST['css_codepress']) > 0) {
-		// Javascript is enabled so take contents from hidden field: css_codepress
-		$css_content = stripslashes($_POST['css_codepress']);
-	} elseif(isset($_POST['css_data']) && strlen($_POST['css_data']) > 0) {
-		// Javascript disabled, take contens from textarea: css_data
-		$css_content = stripslashes($_POST['css_data']);
-	}
-
-	$bytes = 0;
-	if ($css_content != '') {
-		// open the module CSS file for writting
-		$mod_file = @fopen(dirname(__FILE__) .'/' .$_POST['edit_file'], "wb");
-		// write new content to the module CSS file
-		$bytes = @fwrite($mod_file, $css_content);
-		// close the file
-		@fclose($mod_file);
-	}
-
-	// write out status message
-	if($bytes == 0 ) {
-		$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-	} else {
-		$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-	}
-
-} else {
-	/** 
-		MODIFY CONTENTS OF THE CSS FILE VIA TEXT AREA 
-	*/
-	// check if module backend.css file needs to be included into the <body>
-	if((!method_exists($admin, 'register_backend_modfiles') || !isset($_GET['page_id']))
-			&& file_exists(WB_PATH .'/modules/'.$mod_dir.'/backend.css')) {
-		echo '<style type="text/css">';
-		include(WB_PATH .'/modules/' .$mod_dir .'/backend.css');
-		echo "\n</style>\n";
-	}
-
-	// check which module file to edit (frontend.css, backend.css or '')
-	$css_file = (in_array($_POST['edit_file'], array('frontend.css', 'backend.css'))) ? $_POST['edit_file'] : '';
-
-	// display output
-	if($css_file == '') {
-		// no valid module file to edit; display error message and backlink to modify.php
-		echo "<h2>Nothing to edit</h2>";
-		echo "<p>No valid module file exists for this module.</p>";
-		$output  = "<a href=\"#\" onclick=\"javascript: window.location = '";
-		$output .= ADMIN_URL ."/pages/modify.php?page_id=" .$page_id ."'\">back</a>";
-		echo $output;
-	} else {
-		// store content of the module file in variable
-		$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file);
-
-		// make sure that codepress stuff is only used if the framework is available
-		$CODEPRESS['CLASS'] = '';
-		$CODEPRESS['JS'] = '';
-		if(file_exists(WB_PATH .'/include/codepress/codepress.js')) {
-			$CODEPRESS['CLASS'] = 'class="codepress css" ';
-			$CODEPRESS['JS'] = 'onclick="javascript: css_codepress.value = area_codepress.getCode();"';
-		}
-
-		// write out heading
-		echo '<h2>' .$HEADING_CSS_FILE .'"' .$css_file .'"</h2>';
-		// include button to switch between frontend.css and backend.css (only shown if both files exists)
-		toggle_css_file($mod_dir, $css_file); 
-	  echo '<p>' .$TXT_EDIT_CSS_FILE .'</p>';
-
-		// output content of module file to textareas
-	?>
-		<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" style="margin: 0;">
-			<input type="hidden" name="css_codepress" value="" />
-	  	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-	  	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-	  	<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
-			<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" />
-	  	<input type="hidden" name="action" value="save">
-
-			<textarea id="area_codepress" name="css_data" <?php echo $CODEPRESS['CLASS'];?>cols="115" rows="25" wrap="VIRTUAL" 
-				style="margin:2px;"><?php echo $css_content; ?></textarea>
-
-  			<table cellpadding="0" cellspacing="0" border="0" width="100%">
-  			<tr>
-    			<td align="left">
- 				<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>"
-				  <?php echo $CODEPRESS['JS'];?> style="width: 100px; margin-top: 5px;" />
-    			</td>
-  				<td align="right">
-      			<input type="button" value="<?php echo $TEXT['CANCEL']; ?>"
-						onclick="javascript: window.location = '<?php echo ADMIN_URL;?>/pages/modify.php?page_id=<?php echo $page_id; ?>';"
-						style="width: 100px; margin-top: 5px;" />
-  				</td>
-  			</tr>
-  			</table>
-		</form>
-		<?php 
-	}
-}
-
-// Print admin footer
-$admin->print_footer();
-
-?>
\ No newline at end of file

Property changes on: trunk/wb/modules/news/edit_css.php
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: trunk/wb/modules/news/css.functions.php
===================================================================
--- trunk/wb/modules/news/css.functions.php	(revision 800)
+++ trunk/wb/modules/news/css.functions.php	(nonexistent)
@@ -1,105 +0,0 @@
-<?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
-
-*/
-
-// prevent this file from being accessed directly
-if(!defined('WB_PATH')) die(header('Location: index.php'));  
-
-// this function checks the validity of the specified module directory
-if(!function_exists('check_module_dir')) {
-	function check_module_dir($mod_dir) {
-		// check if module directory is formal correct (only characters: "a-z,0-9,_,-")
-		if(!preg_match('/^[a-z0-9_-]+$/iD', $mod_dir)) return '';
-		// check if the module folder contains the required info.php file
-		return (file_exists(WB_PATH .'/modules/' .$mod_dir .'/info.php')) ? $mod_dir : '';
-	}
-}
-
-// this function checks if the specified optional module file exists
-if (!function_exists('mod_file_exists')) {
-	function mod_file_exists($mod_dir, $mod_file='frontend.css') {
-  	// check if the module file exists
-		return file_exists(WB_PATH .'/modules/' .$mod_dir .'/' .$mod_file);
-	}
-}
-
-// this function displays the "Edit CSS" button in modify.php 
-if (!function_exists('css_edit')) {
-	function css_edit($mod_dir) {
-		global $page_id, $section_id, $CAP_EDIT_CSS;
-		// check if specified module directory is valid
-		if(check_module_dir($mod_dir) == '') return;
-		
-		// check if frontend.css or backend.css exist
-		$frontend_css = mod_file_exists($mod_dir, 'frontend.css');
-		$backend_css = mod_file_exists($mod_dir, 'backend.css');
-		
-		// output the edit CSS submtin button if required
-		if($frontend_css || $backend_css) {
-			// default text used for the edit CSS routines if not defined in the modules language file
-			if(!isset($CAP_EDIT_CSS)) $CAP_EDIT_CSS	= 'Edit CSS';
-			?>
-			<form name="edit_module_file" action="<?php echo WB_URL .'/modules/' .$mod_dir .
- 				'/edit_css.php?page_id='.$page_id;?>" method="post" style="margin: 0; align:right;">
-				<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-				<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-				<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
-				<input type="hidden" name="edit_file" value="<?php echo ($frontend_css) ?'frontend.css' : 'backend.css';?>">
-				<input type="hidden" name="action" value="edit">
-				<input type="submit" value="<?php echo $CAP_EDIT_CSS;?>" class="mod_<?php echo $mod_dir;?>_edit_css">
-			</form>
-			<?php
-    }
-  }
-}
-
-// this function displays a button to toggle between CSS files (invoked from edit_css.php)
-if (!function_exists('toggle_css_file')) {
-	function toggle_css_file($mod_dir, $base_css_file = 'frontend.css') {
-		global $page_id, $section_id;
-		// check if specified module directory is valid
-		if(check_module_dir($mod_dir) == '') return;
-
-		// do sanity check of specified css file
-		if(!in_array($base_css_file, array('frontend.css', 'backend.css'))) return;
-		
-		// display button to toggle between the two CSS files: frontend.css, backend.css
-		$toggle_file = ($base_css_file == 'frontend.css') ? 'backend.css' : 'frontend.css';
-		if(mod_file_exists($mod_dir, $toggle_file)) {
-			?>
-			<form name="toggle_module_file" action="<?php echo WB_URL .'/modules/' .$mod_dir .
-				'/edit_css.php?page_id='.$page_id;?>" method="post" style="margin: 0; align:right;">
-				<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-				<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-				<input type="hidden" name="mod_dir" value="<?php echo $mod_dir; ?>">
-				<input type="hidden" name="edit_file" value="<?php echo $toggle_file; ?>">
-				<input type="hidden" name="action" value="edit">
-				<input type="submit" value="<?php echo ucwords($toggle_file);?>" class="mod_<?php echo $mod_dir;?>_edit_css">
-			</form>
-			<?php
-		}
-  }
-}
-
-?>
\ No newline at end of file

Property changes on: trunk/wb/modules/news/css.functions.php
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: trunk/wb/modules/news/modify_settings.php
===================================================================
--- trunk/wb/modules/news/modify_settings.php	(revision 800)
+++ trunk/wb/modules/news/modify_settings.php	(revision 801)
@@ -28,8 +28,8 @@
 // Include WB admin wrapper script
 require(WB_PATH.'/modules/admin.php');
 
-// include functions to edit the optional module CSS files (frontend.css, backend.css)
-require_once('css.functions.php');
+// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
+@include_once(WB_PATH .'/framework/module.functions.php');
 
 // check if module language file exists for the language set by the user (e.g. DE, EN)
 if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
@@ -58,10 +58,12 @@
 ?>
 <h2><?php echo $MOD_NEWS['SETTINGS']; ?></h2>
 <?php
-	// include the button to edit the optional module CSS files
-	// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
-	// Place this call outside of any <form></form> construct!!!
-	css_edit('news');
+// include the button to edit the optional module CSS files (function added with WB 2.7)
+// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
+// Place this call outside of any <form></form> construct!!!
+if(function_exists('edit_module_css')) {
+	edit_module_css('news');
+}
 ?>
 
 <form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;">
