Project

General

Profile

« Previous | Next » 

Revision 592

Added by doc almost 17 years ago

fixed bug in Codepress integration (if codepress framework not installed)

View differences:

edit_css.php
31 31
require_once('css.functions.php');
32 32

  
33 33
// check if action is: save or edit
34
if(isset($_GET['action']) && $_GET['action'] == 'save' && isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
34
if(isset($_GET['action']) && $_GET['action'] == 'save' && 
35
		isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
35 36
	/** 
36 37
	SAVE THE UPDATED CONTENTS TO THE CSS FILE
37 38
	*/
......
81 82
	} else {
82 83
		// store content of the module file in variable
83 84
		$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file);
84
		// output content of module file to textareas
85
		?>
85
	  	// output content of module file to textareas
86 86

  
87
		// make sure that codepress stuff is only used if the framework is available
88
		$CODEPRESS['CLASS'] = '';
89
		$CODEPRESS['JS'] = '';
90
		if(file_exists(WB_PATH .'/include/codepress/codepress.js')) {
91
			$CODEPRESS['CLASS'] = 'class="codepress css" ';
92
			$CODEPRESS['JS'] = 'onclick="javascript: css_codepress.value = area_codepress.getCode();"';
93
		}
94
			
95
	?>
87 96
		<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'] .'?action=save';?>" method="post" style="margin: 0;">
88
			<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
89
			<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
97
	  		<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
98
	  		<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
90 99
			<input type="hidden" name="css_codepress" value="" />
91 100
			<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" />
92

  
101
	
93 102
			<h2><?php echo $HEADING_CSS_FILE .'"' .$css_file; ?>"</h2>
94 103
			<?php 
95 104
				// include the toggle button to switch between frontend.css and backend.css (if both files exists)
96 105
				toggle_css_file($css_file); 
97 106
			?>
98
			
99
			<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> 
100
			
101
			<textarea id="css_data" class="codepress css" cols="115" rows="25"
102
				wrap="VIRTUAL" style="margin:2px;"><?php echo $css_content; ?></textarea>
103
			
104
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
105
				<tr>
106
					<td align="left">
107
						<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>" 
108
							onclick="javascript: css_codepress.value = css_data.getCode();" style="width: 100px; margin-top: 5px;" />
109
					</td>
110
					<td align="right">
111
						<input type="button" value="<?php echo $TEXT['CANCEL']; ?>"	
112
							onclick="javascript: window.location = '<?php echo ADMIN_URL;?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
113
					</td>
114
				</tr>
115
			</table>
107
	  		<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> 
108
			<textarea id="area_codepress" name="css_data" <?php echo $CODEPRESS['CLASS'];?>cols="115" rows="25" wrap="VIRTUAL" 
109
				style="margin:2px;"><?php echo $css_content; ?></textarea>
110

  
111
  			<table cellpadding="0" cellspacing="0" border="0" width="100%">
112
  			<tr>
113
    			<td align="left">
114
 				<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>"
115
				  <?php echo $CODEPRESS['JS'];?> style="width: 100px; margin-top: 5px;" />
116
    			</td>
117
  				<td align="right">
118
      			<input type="button" value="<?php echo $TEXT['CANCEL']; ?>"
119
						onclick="javascript: window.location = '<?php echo ADMIN_URL;?>/pages/modify.php?page_id=<?php echo $page_id; ?>';"
120
						style="width: 100px; margin-top: 5px;" />
121
  				</td>
122
  			</tr>
123
  			</table>
116 124
		</form>
117
	<?php 
125
		<?php 
118 126
	}
119 127
}
120 128

  

Also available in: Unified diff