Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 591)
+++ trunk/CHANGELOG	(revision 592)
@@ -12,6 +12,7 @@
 
 ------------------------------------- 2.7.0 -------------------------------------
 24-Jan-2008 Christian Sommer
+#	fixed bug in Codepress integration (if codepress framework not installed)
 +	added language support to all integrated modules (except for news and form module)
 #	fixed another E_NOTICE warning
 24-Jan-2008 Matthias Gallas
Index: trunk/wb/modules/form/edit_css.php
===================================================================
--- trunk/wb/modules/form/edit_css.php	(revision 591)
+++ trunk/wb/modules/form/edit_css.php	(revision 592)
@@ -31,7 +31,8 @@
 require_once('css.functions.php');
 
 // check if action is: save or edit
-if(isset($_GET['action']) && $_GET['action'] == 'save' && isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
+if(isset($_GET['action']) && $_GET['action'] == 'save' && 
+		isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
 	/** 
 	SAVE THE UPDATED CONTENTS TO THE CSS FILE
 	*/
@@ -81,40 +82,47 @@
 	} else {
 		// store content of the module file in variable
 		$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file);
-		// output content of module file to textareas
-		?>
+	  	// output content of module file to textareas
 
+		// 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();"';
+		}
+			
+	?>
 		<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'] .'?action=save';?>" method="post" style="margin: 0;">
-			<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-			<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="page_id" value="<?php echo $page_id; ?>">
 			<input type="hidden" name="css_codepress" value="" />
 			<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" />
-
+	
 			<h2><?php echo $HEADING_CSS_FILE .'"' .$css_file; ?>"</h2>
 			<?php 
 				// include the toggle button to switch between frontend.css and backend.css (if both files exists)
 				toggle_css_file($css_file); 
 			?>
-			
-			<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> 
-			
-			<textarea id="css_data" class="codepress css" 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'];?>" 
-							onclick="javascript: css_codepress.value = css_data.getCode();" 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>
+	  		<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> 
+			<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 
+		<?php 
 	}
 }
 
Index: trunk/wb/modules/news/edit_css.php
===================================================================
--- trunk/wb/modules/news/edit_css.php	(revision 591)
+++ trunk/wb/modules/news/edit_css.php	(revision 592)
@@ -31,7 +31,8 @@
 require_once('css.functions.php');
 
 // check if action is: save or edit
-if(isset($_GET['action']) && $_GET['action'] == 'save' && isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
+if(isset($_GET['action']) && $_GET['action'] == 'save' && 
+		isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
 	/** 
 	SAVE THE UPDATED CONTENTS TO THE CSS FILE
 	*/
@@ -81,40 +82,47 @@
 	} else {
 		// store content of the module file in variable
 		$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file);
-		// output content of module file to textareas
-		?>
+	  	// output content of module file to textareas
 
+		// 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();"';
+		}
+			
+	?>
 		<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'] .'?action=save';?>" method="post" style="margin: 0;">
-			<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-			<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="page_id" value="<?php echo $page_id; ?>">
 			<input type="hidden" name="css_codepress" value="" />
 			<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" />
-
+	
 			<h2><?php echo $HEADING_CSS_FILE .'"' .$css_file; ?>"</h2>
 			<?php 
 				// include the toggle button to switch between frontend.css and backend.css (if both files exists)
 				toggle_css_file($css_file); 
 			?>
-			
-			<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> 
-			
-			<textarea id="css_data" class="codepress css" 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'];?>" 
-							onclick="javascript: css_codepress.value = css_data.getCode();" 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>
+	  		<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> 
+			<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 
+		<?php 
 	}
 }
 
